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

@alcalzone/jsonl-db

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@alcalzone/jsonl-db - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

1

build/lib/db.d.ts

@@ -16,2 +16,3 @@ export declare class DB<V extends unknown = unknown> {

private _dumpFd;
private _compressBacklog;
private _writeBacklog;

@@ -18,0 +19,0 @@ private _dumpBacklog;

@@ -103,3 +103,11 @@ "use strict";

write(line) {
this._writeBacklog.write(line);
if (this._compressBacklog && !this._compressBacklog.destroyed) {
this._compressBacklog.write(line);
}
else if (this._writeBacklog && !this._writeBacklog.destroyed) {
this._writeBacklog.write(line);
}
else {
throw new Error("Cannot write into the database while no streams are open!");
}
// If necessary, write to the dump backlog, so the dump doesn't miss any data

@@ -188,3 +196,5 @@ if (this._dumpBacklog && !this._dumpBacklog.destroyed) {

this._closeDBPromise = deferred_promise_1.createDeferredPromise();
// Disable writing into the backlog stream
// Disable writing into the backlog stream and buffer all writes
// in the compress backlog in the meantime
this._compressBacklog = new stream.PassThrough({ objectMode: true });
this._writeBacklog.end();

@@ -197,6 +207,16 @@ this._writeBacklog = undefined;

await fs.unlink(this.filename + ".bak");
// Start the write thread
// Start the write thread again
this._openPromise = deferred_promise_1.createDeferredPromise();
void this.writeThread();
await this._openPromise;
// Write all buffered data
this._compressBacklog.pipe(this._writeBacklog, {
// Don't close the target stream!
end: false,
});
this._compressBacklog.on("end", () => {
var _a;
(_a = this._compressBacklog) === null || _a === void 0 ? void 0 : _a.destroy();
this._compressBacklog = undefined;
});
}

@@ -203,0 +223,0 @@ /** Closes the DB and waits for all data to be written */

2

package.json
{
"name": "@alcalzone/jsonl-db",
"version": "0.1.2",
"version": "0.1.3",
"description": "Simple JSONL-based key-value store",

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

@@ -55,2 +55,5 @@ # jsonl-db

### 0.1.3 (2020-04-25)
* Writes that happen while `compress()` replaces files are now persisted
### 0.1.2 (2020-04-25)

@@ -57,0 +60,0 @@ * `compress()` no longer overwrites the main file while the DB is being closed

Sorry, the diff of this file is not supported yet

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