-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Closed
Copy link
Labels
docsThis change adds or pertains to documentationThis change adds or pertains to documentationioInvolving the I/O subsystem: libuv, read, write, etc.Involving the I/O subsystem: libuv, read, write, etc.
Description
Julia has two super easy to use functions:
julia> write("hello.txt", "world")
5
julia> read("hello.txt", String)
"world"That should cover file I/O needs in most cases, without having to deal with file handlers! 🎉 I think this is really useful for many (beginner) users, but not visible enough. Whenever I give this tip to a new Julia user, they react along the lines of: "If only I knew this earlier!"
We should recommend this in our docs. My suggestions:
- Right now, our manual entry on "Working with files" uses
open(filename::String, mode::String)to create a file handler (the first handler is even left open!). Instead, this first example could use my above snippet. (Also, Working with Files could be its own chapter in the manual?) Docs: networking-and-streams: document directreadandwritewithout streaming #49834 writeshould have a short, simple docstring for just thewrite(filename::String, x)method. Docs: simple docstring forwrite(filename::AbstractString, x)#49835 and Docs: simple docstring forread(filename::AbstractString)#49836- The docstrings for
read(filename::String, args...)andwrite(filename::String, x)should appear more prominently in the page IO and Network, before theopenfunction. Simplefilenamemethods should appear beforeIOmethods. Docs: io-network: listread(::String)andwrite(::String,::Any)beforeopen#49837 isfilecould use the directreadandwritemethods. docs:isfile: direct write instead of IO #45261- We could add links to
readandwritefrom the Filesystem chapter. Docs: file: listreadandwriteagain #49838
I would be happy to write this PR myself, let me know which of these points (1-5) are welcome!
hyrodium, barucden, Ellipse0934, oscardssmith, jakobnissen and 6 more
Metadata
Metadata
Assignees
Labels
docsThis change adds or pertains to documentationThis change adds or pertains to documentationioInvolving the I/O subsystem: libuv, read, write, etc.Involving the I/O subsystem: libuv, read, write, etc.