Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

write

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

write

Write data to a file, replacing the file if it already exists and creating any intermediate directories if they don't already exist. Thin wrapper around node's native fs methods.

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7.3M
increased by17.49%
Maintainers
2
Weekly downloads
 
Created

What is write?

The 'write' npm package is a simple utility for writing data to files. It provides a straightforward API for writing strings or buffers to a file, with options to specify encoding, mode, and flag. It's designed to make file writing tasks in Node.js applications easier and more efficient.

What are write's main functionalities?

Write string to file

This feature allows you to write a string directly to a file. The example shows how to synchronously write 'Hello World' to 'file.txt'.

const write = require('write');
write.sync('file.txt', 'Hello World');

Write buffer to file

This feature enables writing buffer data to a file. The code sample demonstrates writing a buffer containing 'Hello World' to 'file.txt'.

const write = require('write');
const buffer = Buffer.from('Hello World', 'utf8');
write.sync('file.txt', buffer);

Write string to file asynchronously

This feature supports asynchronous file writing. The example illustrates how to write 'Hello World' to 'file.txt' and log a message upon completion.

const write = require('write');
write('file.txt', 'Hello World').then(() => console.log('Write complete')).catch(console.error);

Other packages similar to write

Keywords

FAQs

Package last updated on 04 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc