Socket
Socket
Sign inDemoInstall

level-ws

Package Overview
Dependencies
5
Maintainers
3
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0 to 3.0.0

LICENSE

21

CHANGELOG.md
# Changelog
## [3.0.0] - 2021-04-25
_**If you are upgrading:** please see [`UPGRADING.md`](UPGRADING.md)._
## [Unreleased][unreleased]
### Changed
- **Breaking:** drop node 6 and 8 ([Level/community#98](https://github.com/Level/community/issues/98)) ([`2b04c28`](https://github.com/Level/level-ws/commit/2b04c28)) (Vincent Weevers)
- **Breaking:** modernize syntax ([Level/community#98](https://github.com/Level/community/issues/98)) ([`2319634`](https://github.com/Level/level-ws/commit/2319634), [`3fc0829`](https://github.com/Level/level-ws/commit/3fc0829)) (Vincent Weevers)
## [2.0.0] - 2019-03-30

@@ -96,14 +101,16 @@

## 0.0.0 - 2013-10-12
## [0.0.0] - 2013-10-12
:seedling: Initial release.
[unreleased]: https://github.com/level/level-ws/compare/v2.0.0...HEAD
[3.0.0]: https://github.com/Level/level-ws/compare/v2.0.0...v3.0.0
[2.0.0]: https://github.com/level/level-ws/compare/v1.0.0...v2.0.0
[2.0.0]: https://github.com/Level/level-ws/compare/v1.0.0...v2.0.0
[1.0.0]: https://github.com/level/level-ws/compare/v0.1.0...v1.0.0
[1.0.0]: https://github.com/Level/level-ws/compare/v0.1.0...v1.0.0
[0.1.0]: https://github.com/level/level-ws/compare/v0.0.1...v0.1.0
[0.1.0]: https://github.com/Level/level-ws/compare/v0.0.1...v0.1.0
[0.0.1]: https://github.com/level/level-ws/compare/v0.0.0...v0.0.1
[0.0.1]: https://github.com/Level/level-ws/compare/v0.0.0...v0.0.1
[0.0.0]: https://github.com/Level/level-ws/releases/tag/v0.0.0

@@ -1,7 +0,8 @@

var Writable = require('readable-stream').Writable
var inherits = require('inherits')
var extend = require('xtend')
'use strict'
var defaultOptions = { type: 'put' }
const Writable = require('readable-stream').Writable
const inherits = require('inherits')
const defaultOptions = { type: 'put' }
function WriteStream (db, options) {

@@ -12,3 +13,3 @@ if (!(this instanceof WriteStream)) {

options = extend(defaultOptions, options)
options = Object.assign({}, defaultOptions, options)

@@ -26,6 +27,4 @@ Writable.call(this, {

var self = this
this.on('finish', function () {
self.emit('close')
this.on('finish', () => {
this.emit('close')
})

@@ -37,17 +36,16 @@ }

WriteStream.prototype._write = function (data, enc, next) {
var self = this
if (self.destroyed) return
if (this.destroyed) return
if (!self._flushing) {
self._flushing = true
process.nextTick(function () { self._flush() })
if (!this._flushing) {
this._flushing = true
process.nextTick(() => { this._flush() })
}
if (self._buffer.length >= self._maxBufferLength) {
self.once('_flush', function (err) {
if (err) return self.destroy(err)
self._write(data, enc, next)
if (this._buffer.length >= this._maxBufferLength) {
this.once('_flush', (err) => {
if (err) return this.destroy(err)
this._write(data, enc, next)
})
} else {
self._buffer.push(extend({ type: self._options.type }, data))
this._buffer.push(Object.assign({ type: this._options.type }, data))
next()

@@ -58,30 +56,25 @@ }

WriteStream.prototype._flush = function () {
var self = this
var buffer = self._buffer
const buffer = this._buffer
if (self.destroyed) return
if (this.destroyed) return
self._buffer = []
self._db.batch(buffer, cb)
this._buffer = []
this._db.batch(buffer, (err) => {
this._flushing = false
function cb (err) {
self._flushing = false
if (!self.emit('_flush', err) && err) {
if (!this.emit('_flush', err) && err) {
// There was no _flush listener.
self.destroy(err)
this.destroy(err)
}
}
})
}
WriteStream.prototype._final = function (cb) {
var self = this
if (this._flushing) {
// Wait for scheduled or in-progress _flush()
this.once('_flush', function (err) {
this.once('_flush', (err) => {
if (err) return cb(err)
// There could be additional buffered writes
self._final(cb)
this._final(cb)
})

@@ -88,0 +81,0 @@ } else if (this._buffer && this._buffer.length) {

{
"name": "level-ws",
"version": "2.0.0",
"version": "3.0.0",
"description": "A basic WriteStream implementation for LevelUP",

@@ -9,3 +9,3 @@ "license": "MIT",

"test": "standard && hallmark && nyc node test.js",
"coverage": "nyc report --reporter=text-lcov | coveralls",
"coverage": "nyc report -r lcovonly",
"hallmark": "hallmark --fix",

@@ -15,26 +15,22 @@ "dependency-check": "dependency-check . test.js",

},
"files": [
"level-ws.js",
"CHANGELOG.md",
"UPGRADING.md"
],
"dependencies": {
"inherits": "^2.0.3",
"readable-stream": "^3.1.0",
"xtend": "^4.0.1"
"readable-stream": "^3.1.0"
},
"devDependencies": {
"coveralls": "^3.0.1",
"dependency-check": "^3.3.0",
"hallmark": "^0.1.0",
"level": "^5.0.1",
"level-community": "^3.0.0",
"level-concat-iterator": "^2.0.0",
"nyc": "^13.2.0",
"hallmark": "^3.1.0",
"level": "^7.0.0",
"level-concat-iterator": "^3.0.0",
"nyc": "^15.1.0",
"secret-event-listener": "^1.0.0",
"standard": "^12.0.0",
"tape": "^4.9.0",
"tempy": "^0.2.1"
"standard": "^16.0.3",
"tape": "^5.0.1",
"tempy": "^1.0.1"
},
"hallmark": {
"community": "level-community",
"ignore": [
"CONTRIBUTORS.md"
]
},
"repository": {

@@ -52,4 +48,4 @@ "type": "git",

"engines": {
"node": ">=6"
"node": ">=10"
}
}

@@ -8,8 +8,7 @@ # level-ws

[![Node version](https://img.shields.io/node/v/level-ws.svg)](https://www.npmjs.com/package/level-ws)
[![Travis](https://img.shields.io/travis/Level/level-ws.svg?logo=travis&label=)](https://travis-ci.org/Level/level-ws)
[![Test](https://github.com/Level/level-ws/actions/workflows/test.yml/badge.svg)](https://github.com/Level/level-ws/actions/workflows/test.yml)
[![npm](https://img.shields.io/npm/dm/level-ws.svg?label=dl)](https://www.npmjs.com/package/level-ws)
[![Coverage Status](https://coveralls.io/repos/github/Level/level-ws/badge.svg)](https://coveralls.io/github/Level/level-ws)
[![Coverage Status](https://codecov.io/gh/Level/level-ws/branch/master/graph/badge.svg)](https://codecov.io/gh/Level/level-ws)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
[![Backers on Open Collective](https://opencollective.com/level/backers/badge.svg?color=orange)](#backers)
[![Sponsors on Open Collective](https://opencollective.com/level/sponsors/badge.svg?color=orange)](#sponsors)
[![Funding](https://opencollective.com/level/tiers/badge.svg)](#donate)

@@ -123,16 +122,16 @@ `level-ws` provides the most basic general-case WriteStream for `levelup`. It was extracted from the core `levelup` at version 0.18.0.

To sustain [`Level`](https://github.com/Level) and its activities, become a backer or sponsor on [Open Collective](https://opencollective.com/level). Your logo or avatar will be displayed on our 28+ [GitHub repositories](https://github.com/Level), [npm](https://www.npmjs.com/) packages and (soon) [our website](http://leveldb.org). 💖
Support us with a monthly donation on [Open Collective](https://opencollective.com/level) and help us continue our work. Your logo or avatar will be displayed on our 28+ [GitHub repositories](https://github.com/Level) and [npm](https://www.npmjs.com/) packages. 💖
### Backers
**Active financial contributors**
[![Open Collective backers](https://opencollective.com/level/backers.svg?width=890)](https://opencollective.com/level)
[![Open Collective backers](https://opencollective.com/level/tiers/backer.svg?button=false)](https://opencollective.com/level) [![Open Collective sponsors](https://opencollective.com/level/tiers/sponsor.svg?button=false)](https://opencollective.com/level)
### Sponsors
**Past financial contributors**
[![Open Collective sponsors](https://opencollective.com/level/sponsors.svg?width=890)](https://opencollective.com/level)
[![Open Collective sponsors](https://opencollective.com/level/sponsors.svg?button=false&avatarHeight=36)](https://opencollective.com/level) [![Open Collective backers](https://opencollective.com/level/backers.svg?button=false&avatarHeight=36)](https://opencollective.com/level)
## License
[MIT](LICENSE.md) © 2012-present [Contributors](CONTRIBUTORS.md).
[MIT](LICENSE)
[level-badge]: http://leveldb.org/img/badge.svg
[level-badge]: https://leveljs.org/img/badge.svg

@@ -5,7 +5,16 @@ # Upgrade Guide

## v2
## 3.0.0
This release drops support of legacy runtime environments ([Level/community#98](https://github.com/Level/community/issues/98)):
- Node.js 6 and 8
- Internet Explorer 11
- Safari 9-11
- Stock Android browser (AOSP).
## 2.0.0
Dropped node 9 and upgraded to [`readable-stream@3`](https://github.com/nodejs/readable-stream#version-3xx).
## v1
## 1.0.0

@@ -12,0 +21,0 @@ Dropped support for node 0.10, 0.12, 2, 3, 4 and 5.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc