## file > There are many provided methods for reading and writing files, traversing the filesystem and finding files by matching globbing patterns. Many of these methods are wrappers around built-in Node.js file functionality, but with additional error handling, logging and character encoding normalization. ### Methods #### file.exists(filepath)
Describe: File exists
Describe: Is the given path a file? Returns a boolean.
Describe: Is the given path a plaintext file? Returns a boolean.
Describe: Is the given path a UTF8 encoding file? Returns a boolean.
Describe: File suffix append
Return: {*}
Example:
```js file.suffiex("jquery.js", "min") // => jquery.min.js ```Describe: Is the given path a directory? Returns a boolean.
Describe: Is dir format name
Describe: Read a file from the filesystem and parse as JSON
Describe: Looks for a project's package.json file. Walks up the directory tree untilit finds a package.json file or hits the root. Does not throw when nopackages.json is found, just returns null.
Describe: Read a package.json file's contents, parsing the data as JSON and returning the result
Describe: List directories within a directory.
Describe: Get the pattern matched files, default root dir is cwd
Describe: Return a unique array of all file or directory paths that match the given globbing pattern(s).
Return: {array} matche files
Example:
```js file.expand(['!./foo/.css', './foo/']) ```Describe: Delete the specified filepath. Will delete files and folders recursively.
Describe: Read and return a file's contents.
Describe: Write the specified contents to a file, creating intermediate directories if necessary
Describe: Write the specified contents to a temp file
Describe: Copy a source file or directory to a destination path, creating intermediate directories if necessary
Describe: Search for a filename in the given directory or all parent directories.
Return: {string}
Describe: Given a path to a directory, create it, and all the intermediate directories as well
Example:
```js file.mkdir("/tmp/dir", 755) ```Describe: Create temp dir
Return: {string}
Describe: Recurse into a directory, executing callback for each file.
Example:
```js file.walkdir("/tmp", function(error, path, dirs, name) { // path is the current directory we're in // dirs is the list of directories below it // names is the list of files in it }) ```