Wondering what’s next for npm?Check out our public roadmap! »

write-file-safe
TypeScript icon, indicating that this package has built-in type declarations

1.2.2 • Public • Published

Write files and create parent directories if necessary.

Installation

yarn add write-file-safe
npm install write-file-safe

API

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;
}

Dev DependenciesDavid


License license

MIT


Related Packages

Install

npm i write-file-safe

DownloadsWeekly Downloads

34

Version

1.2.2

License

MIT

Unpacked Size

9.65 kB

Total Files

7

Last publish

Collaborators

  • avatar