Skip to main content

tools-filesystem

Build npm version

@rnx-kit/tools-filesystem is a collection of commonly used functions for manipulating the filesystem.

You can import the entire package, or, to save space, import individual categories:

import * as tools from "@rnx-kit/tools-filesystem";

// Alternatively...
import * as mocks from "@rnx-kit/tools-filesystem/mocks";
CategoryFunctionDescription
-ensureDir(path)Ensures that a directory exists, creating it if necessary.
-ensureDirForFile(p)Ensures that the directory for a given file path exists, creating it if necessary.
-writeJSONFile(path, data, space)Writes specified data to a file, serialized as JSON format.
-writeTextFile(path, data)Writes specified data to a file, assuming the data is UTF-8 encoded text.