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 files to disk, creating intermediate directories if they don't exist.

  • 0.3.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4M
decreased by-12.41%
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 24 Mar 2017

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