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

fs-readfile-promise

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fs-readfile-promise - npm Package Compare versions

Comparing version 3.0.1 to 4.0.0-0

21

index.js
'use strict';
const readFile = require('graceful-fs').readFile;
const {readFile} = require('graceful-fs');
module.exports = function fsReadFilePromise(filePath, options) {
const ARG_ERROR = 'Expected 1 or 2 arguments (<string|Buffer|URL|integer>[, <Object|string>])';
module.exports = function fsReadFilePromise(...args) {
const argLen = args.length;
if (argLen === 0) {
const error = new RangeError(`${ARG_ERROR}, but got no arguments.`);
error.code = 'ERR_MISSING_ARGS';
return Promise.reject(error);
}
if (argLen > 2) {
return Promise.reject(new RangeError(`${ARG_ERROR}, but got ${argLen} arguments.`));
}
return new Promise((resolve, reject) => {
readFile(filePath, options, (err, data) => {
readFile(...args, (err, data) => {
if (err) {

@@ -9,0 +24,0 @@ reject(err);

2

package.json
{
"name": "fs-readfile-promise",
"version": "3.0.1",
"version": "4.0.0-0",
"description": "Promise version of fs.readFile",

@@ -5,0 +5,0 @@ "repository": "shinnn/fs-readfile-promise",

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