JSPM

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

Create the directory structure and then create the file.

Package Exports

  • write-file-p

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-p) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

write-file-p

PayPal AMA Version Downloads Get help on Codementor

Create the directory structure and then create the file.

☁️ Installation

$ npm i --save write-file-p

📋 Example

const writeFileP = require("write-file-p");

// Write a text file
writeFileP(`${__dirname}/foo/bar/output.txt`, "Hello World", (err, data) => {
    console.log(err || data);
});


// Write a json syncronously
writeFileP.sync(`${__dirname}/bar/bar/output.json`, {
    hello: "world"
});
// .
// ├── bar
// │   └── bar
// │       └── output.json
// └── foo
//     └── bar
//         └── output.txt

📝 Documentation

writeFileP(outputPath, data, cb)

Create the directory structure and then create the file.

Params

  • String outputPath: The path to the file you want to create.
  • String|Object data: The file content. If an Array/Object is provided, it will be stringified.
  • Function cb: The callback function.

writeFileP.sync(outputPath, data)

The sync version of the function.

Params

  • String outputPath: The path to the file you want to create.
  • String|Object data: The file content. If an Array/Object is provided, it will be stringified.

Return

  • String|Object The content written in the file. If an object was provided, the stringified version will not be returned but the raw value.

😋 How to contribute

Have an idea? Found a bug? See how to contribute.

📜 License

MIT © Ionică Bizău