diff --git a/base/io.jl b/base/io.jl index 9c00c57576bac..2f7ec595f0dc2 100644 --- a/base/io.jl +++ b/base/io.jl @@ -224,7 +224,6 @@ read(stream, ::Type{Union{}}, slurp...; kwargs...) = error("cannot read a value """ write(io::IO, x) - write(filename::AbstractString, x) Write the canonical binary representation of a value to the given I/O stream or file. Return the number of bytes written into the stream. See also [`print`](@ref) to @@ -458,6 +457,14 @@ wait_close(io::AbstractPipe) = (wait_close(pipe_writer(io)::IO); wait_close(pipe # Exception-safe wrappers (io = open(); try f(io) finally close(io)) + +""" + write(filename::AbstractString, content) + +Write the canonical binary representation of `content` to a file, which will be created if it does not exist yet or overwritten if it does exist. + +Return the number of bytes written into the file. +""" write(filename::AbstractString, a1, args...) = open(io->write(io, a1, args...), convert(String, filename)::String, "w") """