write-file-safe
Write files, and create parent directories if necessary.
Last updated 4 years ago by bconnorwhite .
MIT · Repository · Original npm · Tarball · package.json
$ gnpm install write-file-safe 
SYNC missed versions from official npm registry.

write-file-safe

NPM TypeScript Coverage Status

Write files atomically, and create parent directories if necessary.

If I should maintain this repo, please ⭐️ GitHub stars

DM me on Twitter if you have questions or suggestions. Twitter


Installation

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

Usage

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


Dependenciesdependencies


Dev Dependencies

  • autorepo: Autorepo abstracts away your dev dependencies, providing a single command to run all of your scripts.

License license

MIT - MIT License


Related Packages

Current Tags

  • 2.0.1                                ...           latest (2 years ago)

12 Versions

  • 2.0.1                                ...           2 years ago
  • 2.0.0                                ...           2 years ago
  • 1.3.1                                ...           4 years ago
  • 1.2.3                                ...           4 years ago
  • 1.2.2                                ...           4 years ago
  • 1.2.1                                ...           4 years ago
  • 1.2.0                                ...           4 years ago
  • 1.1.0                                ...           4 years ago
  • 1.0.3                                ...           4 years ago
  • 1.0.2                                ...           4 years ago
  • 1.0.1                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
Downloads
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 2
Last Month 0
Dependencies (7)
Dev Dependencies (0)
None

Copyright 2013 - present © cnpmjs.org | Home |