Socket
Socket
Sign inDemoInstall

file-timestamp-stream

Package Overview
Dependencies
15
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.0 to 1.2.0

4

CHANGELOG.md
# Changelog
## v1.2.0 2018-09-12
* New streams are `WriteStream` so `close` method can be used instead `end`.
## v1.1.0 2018-09-12

@@ -4,0 +8,0 @@

4

lib/file-timestamp-stream.d.ts
/// <reference types="node" />
import fs from 'fs';
import fs, { WriteStream } from 'fs';
import { Writable, WritableOptions } from 'stream';

@@ -15,3 +15,3 @@ export interface FileTimestampStreamOptions extends WritableOptions {

currentFilename?: string;
stream?: Writable;
stream?: WriteStream;
newFilename: (fileTimestampStream: FileTimestampStream) => string;

@@ -18,0 +18,0 @@ private streams;

@@ -53,7 +53,5 @@ "use strict";

if (this.stream) {
this.stream.end(callback);
this.stream.close();
}
else {
callback();
}
callback();
}

@@ -80,5 +78,7 @@ _destroy(error, callback) {

if (this.streams.size > 0) {
this.streams.forEach((stream) => {
stream.destroy();
});
if (HAS_DESTROY) {
this.streams.forEach((stream) => {
stream.destroy();
});
}
this.streams.clear();

@@ -96,3 +96,3 @@ }

if (this.currentFilename && this.stream) {
this.stream.end();
this.stream.close();
const streamErrorHandler = this.streamErrorHandlers.get(this.currentFilename);

@@ -99,0 +99,0 @@ if (streamErrorHandler) {

{
"name": "file-timestamp-stream",
"version": "1.1.0",
"version": "1.2.0",
"description": "Writing stream with file rotating based on timestamp",

@@ -5,0 +5,0 @@ "main": "lib/file-timestamp-stream.js",

/// <reference types="node" />
import fs from 'fs'
import fs, { WriteStream } from 'fs'
import { Writable, WritableOptions } from 'stream'

@@ -26,6 +26,6 @@ import strftime from 'ultra-strftime'

currentFilename?: string
stream?: Writable
stream?: WriteStream
newFilename: (fileTimestampStream: FileTimestampStream) => string
private streams: Map<string, Writable> = new Map()
private streams: Map<string, WriteStream> = new Map()
private streamCancelFinishers: Map<string, () => void> = new Map()

@@ -74,6 +74,5 @@ private streamErrorHandlers: Map<string, (err: Error) => void> = new Map()

if (this.stream) {
this.stream.end(callback)
} else {
callback()
this.stream.close()
}
callback()
}

@@ -101,5 +100,7 @@

if (this.streams.size > 0) {
this.streams.forEach((stream) => {
stream.destroy()
})
if (HAS_DESTROY) {
this.streams.forEach((stream) => {
stream.destroy()
})
}
this.streams.clear()

@@ -122,3 +123,3 @@ }

if (this.currentFilename && this.stream) {
this.stream.end()
this.stream.close()
const streamErrorHandler = this.streamErrorHandlers.get(this.currentFilename)

@@ -125,0 +126,0 @@ if (streamErrorHandler) {

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