npm

Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript.Learn more »

This package has been deprecated

Author message:

Use methods from fs module on Node.js >= 6.

fs-file-sync-fd

0.1.0 • Public • Published

Backported fs.*FileSync Functions

Build status Dependency Status Supported Node Version Version on NPM

Standalone version of fs.readFileSync, fs.writeFileSync, and fs.appendFileSync from nodejs/node@08039628, which accept file descriptor arguments for synchronously reading and writing to open file descriptors.

This module uses the fs module sources and tests from nodejs/node@08039628 with only the changes necessary to support older versions of Node.js (e.g. replacing octal literals with decimal to support v0.12 and earlier).

When running on a version of Node.js which includes 08039628, the fs functions will be returned in preference to the versions in this module.

Introductory Example

var fs = require('fs');
var readFileSync = require('fs-file-sync-fd').readFileSync;
 
var fd = fs.openSync('package.json', 'r');
var packageJson = JSON.parse(readFileSync(fd, {encoding: 'utf8'}));
console.log('Package Version: ' + packageJson.version);

Installation

This package can be installed using npm, either globally or locally, by running:

npm install fs-file-sync-fd

Recipes

Read everything from stdin

var readFileSync = require('fs-file-sync-fd').readFileSync;
var stdinContent = readFileSync(0);

Append to stdout

var appendFileSync = require('fs-file-sync-fd').appendFileSync;
appendFileSync(1, 'Hello ');
appendFileSync(1, 'World\n');

API Docs

The functions in this module are documented as part of the Node.js API:

License

This package is available under the terms of the MIT License.

install

npm i fs-file-sync-fd

Downloadsweekly downloads

4

version

0.1.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability