Socket
Socket
Sign inDemoInstall

sonic-boom

Package Overview
Dependencies
Maintainers
3
Versions
61
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 4.0.1 to 4.1.0

test/periodicflush.test.js

22

index.js

@@ -19,2 +19,5 @@ 'use strict'

const [major, minor] = process.versions.node.split('.').map(Number)
const kCopyBuffer = major >= 22 && minor >= 7
function openFile (file, sonic) {

@@ -99,3 +102,3 @@ sonic._opening = true

let { fd, dest, minLength, maxLength, maxWrite, sync, append = true, mkdir, retryEAGAIN, fsync, contentMode, mode } = opts || {}
let { fd, dest, minLength, maxLength, maxWrite, periodicFlush, sync, append = true, mkdir, retryEAGAIN, fsync, contentMode, mode } = opts || {}

@@ -119,2 +122,4 @@ fd = fd || dest

this.maxWrite = maxWrite || MAX_WRITE
this._periodicFlush = periodicFlush || 0
this._periodicFlushTimer = undefined
this.sync = sync || false

@@ -248,2 +253,7 @@ this.writable = true

})
if (this._periodicFlush !== 0) {
this._periodicFlushTimer = setInterval(() => this.flush(null), this._periodicFlush)
this._periodicFlushTimer.unref()
}
}

@@ -643,2 +653,8 @@

} else {
// fs.write will need to copy string to buffer anyway so
// we do it here to avoid the overhead of calculating the buffer size
// in releaseWritingBuf.
if (kCopyBuffer) {
this._writingBuf = Buffer.from(this._writingBuf)
}
fs.write(this.fd, this._writingBuf, release)

@@ -654,2 +670,6 @@ }

if (sonic._periodicFlushTimer !== undefined) {
clearInterval(sonic._periodicFlushTimer)
}
sonic.destroyed = true

@@ -656,0 +676,0 @@ sonic._bufs = []

5

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

@@ -37,3 +37,4 @@ "main": "index.js",

"@fastify/pre-commit": "^2.1.0",
"@types/node": "^20.1.0",
"@sinonjs/fake-timers": "^11.2.2",
"@types/node": "^22.0.0",
"fastbench": "^1.0.1",

@@ -40,0 +41,0 @@ "proxyquire": "^2.1.3",

@@ -65,2 +65,3 @@ # sonic-boom

* `maxWrite`: the maximum number of bytes that can be written; default: 16384
* `periodicFlush`: calls `flush` every x`ms`.
* `sync`: perform writes synchronously (similar to `console.log`).

@@ -67,0 +68,0 @@ * `fsync`: perform a [fsyncSync](https://nodejs.org/api/fs.html#fsfsyncsyncfd) every time a write is completed.

@@ -15,2 +15,3 @@ // Type definitions for sonic-boom 0.7

maxWrite?: number
periodicFlush?: number
sync?: boolean

@@ -17,0 +18,0 @@ fsync?: boolean

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