$ gnpm install write-file-safe
Write files atomically, and create parent directories if necessary.
If I should maintain this repo, please ⭐️
DM me on Twitter if you have questions or suggestions.
yarn add write-file-safe
npm install write-file-safe
pnpm add write-file-safe
import { writeFile, writeFileSync, Options } from "write-file-safe";
function writeFile(path: string, content?: string | Buffer): Promise<boolean>;
function writeFileSync(path: string, content?: string | Buffer): boolean;
type Options = {
/**
* Recursively create parent directories if needed. Default: `true`
*/
recursive?: boolean;
/**
* Ensure file ends with a newline. Default: `true`
*/
appendNewline?: boolean;
/**
* Write even if file already exists. Default: `true`
*/
overwrite?: boolean;
};
MIT - MIT License
Copyright 2013 - present © cnpmjs.org | Home |