Examples using... "io/ioutil"

Recent
Walk walks the file tree rooted at root, calling walkFn for each file or directory in the tree, including root. All errors that arise visiting files and directories are filtered by walkFn. The files are walked in lexical order, which makes the output deterministic but means that for very large direc...
StderrPipe returns a pipe that will be connected to the command's standard error when the command starts.
ReadMessage reads a message from r. The headers are parsed, and the body of the message will be available for reading from msg.Body.
Get issues a GET to the specified URL. If the response is one of the following redirect codes, Get follows the redirect, up to a maximum of 10 redirects:
ReverseProxy is an HTTP Handler that takes an incoming request and sends it to another server, proxying the response back to the client.
DumpRequest returns the given request in its HTTP/1.x wire representation. It should only be used by servers to debug client requests. The returned representation is an approximation only; some details of the initial request are lost while parsing it into an http.Request. In particular, the order an...
A Server is an HTTP server listening on a system-chosen port on the local loopback interface, for use in end-to-end HTTP tests.
ResponseRecorder is an implementation of http.ResponseWriter that records its mutations for later inspection in tests.
NewTLSServer starts and returns a new Server using TLS. The caller should call Close when finished, to shut it down.
NewReader returns a quoted-printable reader, decoding from r.
NewReader creates a new multipart Reader reading from r using the given MIME boundary.
DecodeHeader decodes all encoded-words of the given string. It returns an error if and only if CharsetReader of d returns an error.
WriteFile writes data to a file named by filename. If the file does not exist, WriteFile creates it with permissions perm; otherwise WriteFile truncates it before writing.
TempFile creates a new temporary file in the directory dir, opens the file for reading and writing, and returns the resulting *os.File. The filename is generated by taking pattern and adding a random string to the end. If pattern includes a "*", the random string replaces the last "*". If dir is the...
TempFile creates a new temporary file in the directory dir, opens the file for reading and writing, and returns the resulting *os.File. The filename is generated by taking pattern and adding a random string to the end. If pattern includes a "*", the random string replaces the last "*". If dir is the...
TempDir creates a new temporary directory in the directory dir with a name beginning with prefix and returns the path of the new directory. If dir is the empty string, TempDir uses the default directory for temporary files (see os.TempDir). Multiple programs calling TempDir simultaneously will not c...
ReadFile reads the file named by filename and returns the contents. A successful call returns err == nil, not err == EOF. Because ReadFile reads the whole file, it does not treat an EOF from Read as an error to be reported.
ReadDir reads the directory named by dirname and returns a list of directory entries sorted by filename.
ReadAll reads from r until an error or EOF and returns the data it read. A successful call returns err == nil, not err == EOF. Because ReadAll is defined to read from src until EOF, it does not treat an EOF from Read as an error to be reported.
TeeReader returns a Reader that writes to w what it reads from r. All reads from r performed through it are matched with corresponding writes to w. There is no internal buffering - the write must complete before the read completes. Any error encountered while writing is reported as a read error.
Go has several useful functions for working with directories in the file system.