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

sonic-boom

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sonic-boom - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

16

index.js

@@ -23,3 +23,7 @@ 'use strict'

sonic.file = file
fs.open(file, 'a', (err, fd) => {
// NOTE: 'error' and 'ready' events emitted below only relevant when sonic.sync===false
// for sync mode, there is no way to add a listener that will receive these
function fileOpened (err, fd) {
if (err) {

@@ -46,3 +50,11 @@ sonic.emit('error', err)

}
})
}
if (sonic.sync) {
const fd = fs.openSync(file, 'a')
fileOpened(null, fd)
process.nextTick(() => sonic.emit('ready'))
} else {
fs.open(file, 'a', fileOpened)
}
}

@@ -49,0 +61,0 @@

2

package.json
{
"name": "sonic-boom",
"version": "1.0.1",
"version": "1.0.2",
"description": "Extremely fast utf8 only stream implementation",

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

@@ -60,3 +60,5 @@ # sonic-boom  ![Node.js CI](https://github.com/mcollina/sonic-boom/workflows/Node.js%20CI/badge.svg)

A `SonicBoom` instance will emit the `'ready'` event when a file descriptor is available.
For `sync:false` a `SonicBoom` instance will emit the `'ready'` event when a file descriptor is available.
For `sync:true` this is not relevant because the `'ready'` event will be fired when the `SonicBoom` instance is created, before it can be subscribed to.

@@ -94,3 +96,3 @@ ### SonicBoom#write(string)

### SonicBook#destroy()
### SonicBoom#destroy()

@@ -97,0 +99,0 @@ Closes the stream immediately, the data is not flushed.

@@ -763,1 +763,12 @@ 'use strict'

})
// for context see this issue https://github.com/pinojs/pino/issues/871
test('file specified by dest path available immediately when options.sync is true', (t) => {
t.plan(3)
const dest = file()
const stream = new SonicBoom({ dest, sync: true })
t.ok(stream.write('hello world\n'))
t.ok(stream.write('something else\n'))
stream.flushSync()
t.pass('file opened and written to without error')
})
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