JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5041
  • Score
    100M100P100Q128431F
  • License MIT

Write files and create parent directories if necessary

Package Exports

  • write-file-safe

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (write-file-safe) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme


Write files and create parent directories if necessary. Concurrent file writes are queued to ensure they are applied in order.

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