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

@seald-io/nedb

Package Overview
Dependencies
Maintainers
3
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@seald-io/nedb - npm Package Compare versions

Comparing version 2.1.0-2 to 2.1.0-3

48

lib/storage.js

@@ -75,2 +75,30 @@ /**

/**
* Fully write or rewrite the datafile
* @param {String} filename
* @param {String[]} lines
* @param {Function} callback
*/
storage.writeFileLines = (filename, lines, callback = () => {}) => {
try {
const stream = fs.createWriteStream(filename)
const readable = Readable.from(lines)
readable.on('data', (line) => {
try {
stream.write(line)
stream.write('\n')
} catch (err) {
callback(err)
}
})
readable.on('end', () => {
stream.close(callback)
})
readable.on('error', callback)
stream.on('error', callback)
} catch (err) {
callback(err)
}
}
/**
* Fully write or rewrite the datafile, immune to crashes during the write operation (data will not be lost)

@@ -93,21 +121,3 @@ * @param {String} filename

cb => {
try {
const stream = fs.createWriteStream(tempFilename)
const readable = Readable.from(lines)
readable.on('data', (line) => {
try {
stream.write(line)
stream.write('\n')
} catch (err) {
cb(err)
}
})
readable.on('end', () => {
stream.close(cb)
})
readable.on('error', cb)
stream.on('error', cb)
} catch (err) {
cb(err)
}
storage.writeFileLines(tempFilename, lines, cb)
},

@@ -114,0 +124,0 @@ async.apply(storage.flushToStorage, tempFilename),

{
"name": "@seald-io/nedb",
"version": "2.1.0-2",
"version": "2.1.0-3",
"files": [

@@ -5,0 +5,0 @@ "lib/**/*.js",

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