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

bare-fs

Package Overview
Dependencies
Maintainers
2
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bare-fs - npm Package Compare versions

Comparing version 1.5.4 to 1.5.5

71

index.js

@@ -472,54 +472,2 @@ const { Readable, Writable } = require('streamx')

function opendir (path, opts, cb) {
if (typeof opts === 'function') return opendir(path, null, opts)
if (typeof cb !== 'function') throw typeError('ERR_INVALID_ARG_TYPE', 'Callback must be a function')
if (typeof opts === 'string') opts = { encoding: opts }
if (!opts) opts = {}
const {
encoding = 'utf8'
} = opts
const req = getReq()
req.buffer = Buffer.allocUnsafe(binding.sizeofFSDir)
req.callback = function (err, _, buf) {
if (err) return cb(err, null)
cb(null, new Dir(buf, encoding))
}
binding.opendir(req.handle, path, req.buffer)
}
function readdir (dir, opts, cb) {
if (typeof opts === 'function') return readdir(dir, null, opts)
if (typeof cb !== 'function') throw typeError('ERR_INVALID_ARG_TYPE', 'Callback must be a function')
if (typeof opts === 'string') opts = { encoding: opts }
if (!opts) opts = {}
if (typeof dir === 'string') {
return opendir(dir, opts, (err, dir) => {
if (err) return cb(err, null)
return readdir(dir, opts, cb)
})
}
const {
encoding = 'utf8',
bufferSize = 32
} = opts
const req = getReq()
req.buffer = Buffer.allocUnsafe(binding.sizeofFSDirent * bufferSize)
req.callback = function (err, _, buf) {
if (err) return cb(err, null)
binding.toDirent(dir._handle)
}
binding.readdir(req.handle, dir._handle, req.buffer)
}
function readFile (path, opts, cb) {

@@ -758,15 +706,2 @@ if (typeof opts === 'function') return readFile(path, null, opts)

class Dir extends Readable {
constructor (handle, encoding) {
super()
this._handle = handle
this._encoding = encoding
}
_read (cb) {
cb(null)
}
}
exports.promises = {}

@@ -831,8 +766,2 @@

exports.opendir = opendir
exports.promises.opendir = promisify(opendir)
exports.readdir = readdir
exports.promises.readdir = promisify(readdir)
exports.ReadStream = FileReadStream

@@ -839,0 +768,0 @@ exports.createReadStream = (path, options) => new FileReadStream(path, options)

2

package.json
{
"name": "bare-fs",
"version": "1.5.4",
"version": "1.5.5",
"description": "Native file system for Javascript",

@@ -5,0 +5,0 @@ "main": "index.js",

Sorry, the diff of this file is not supported yet

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