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

file-disk

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

file-disk - npm Package Compare versions

Comparing version 6.0.1 to 6.0.2-tslib-e118190a2547a7003f2fc15bb430812078618551

1

build/diskchunk.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DiscardDiskChunk = exports.BufferDiskChunk = exports.DiskChunk = void 0;
const interval_intersection_1 = require("./interval-intersection");

@@ -4,0 +5,0 @@ /*

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.write = exports.read = exports.fdatasync = exports.fstat = exports.close = exports.open = void 0;
const Bluebird = require("bluebird");

@@ -4,0 +5,0 @@ const fs = require("fs");

60

build/index.js
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BufferDisk = exports.FileDisk = exports.Disk = exports.openFile = exports.DiskStream = exports.DiskChunk = exports.DiscardDiskChunk = exports.BufferDiskChunk = void 0;
const tslib_1 = require("tslib");
const Bluebird = require("bluebird");
const stream_1 = require("stream");
const diskchunk_1 = require("./diskchunk");
exports.BufferDiskChunk = diskchunk_1.BufferDiskChunk;
exports.DiscardDiskChunk = diskchunk_1.DiscardDiskChunk;
exports.DiskChunk = diskchunk_1.DiskChunk;
Object.defineProperty(exports, "BufferDiskChunk", { enumerable: true, get: function () { return diskchunk_1.BufferDiskChunk; } });
Object.defineProperty(exports, "DiscardDiskChunk", { enumerable: true, get: function () { return diskchunk_1.DiscardDiskChunk; } });
Object.defineProperty(exports, "DiskChunk", { enumerable: true, get: function () { return diskchunk_1.DiskChunk; } });
const fs = require("./fs");

@@ -31,3 +25,3 @@ const interval_intersection_1 = require("./interval-intersection");

__read(size) {
return __awaiter(this, void 0, void 0, function* () {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
if (this.isReading) {

@@ -115,3 +109,3 @@ // We're already reading, return.

// });
return fs.open(path, flags, mode).disposer(fd => {
return fs.open(path, flags, mode).disposer((fd) => {
return fs.close(fd);

@@ -151,3 +145,3 @@ });

read(buffer, _bufferOffset, length, fileOffset) {
return __awaiter(this, void 0, void 0, function* () {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const plan = this.createReadPlan(fileOffset, length);

@@ -158,3 +152,3 @@ return yield this.readAccordingToPlan(buffer, plan);

write(buffer, bufferOffset, length, fileOffset) {
return __awaiter(this, void 0, void 0, function* () {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
if (this.recordWrites) {

@@ -183,3 +177,3 @@ const chunk = new diskchunk_1.BufferDiskChunk(buffer.slice(bufferOffset, bufferOffset + length), fileOffset);

flush() {
return __awaiter(this, void 0, void 0, function* () {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
if (!this.readOnly) {

@@ -191,3 +185,3 @@ return yield this._flush();

discard(offset, length) {
return __awaiter(this, void 0, void 0, function* () {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
this.insertDiskChunk(new diskchunk_1.DiscardDiskChunk(offset, length));

@@ -197,3 +191,3 @@ });

getCapacity() {
return __awaiter(this, void 0, void 0, function* () {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
if (this.capacity === null) {

@@ -206,3 +200,3 @@ this.capacity = yield this._getCapacity();

getStream(position = 0, length = null, highWaterMark = DEFAULT_HIGH_WATER_MARK) {
return __awaiter(this, void 0, void 0, function* () {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
let end = yield this.getCapacity();

@@ -216,3 +210,3 @@ if (length !== null) {

getDiscardedChunks() {
return this.knownChunks.filter(chunk => {
return this.knownChunks.filter((chunk) => {
return chunk instanceof diskchunk_1.DiscardDiskChunk;

@@ -222,3 +216,3 @@ });

getRanges(blockSize) {
return __awaiter(this, void 0, void 0, function* () {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
return Array.from(yield mapped_ranges_1.getRanges(this, blockSize));

@@ -264,6 +258,6 @@ });

if (!this.discardIsZero) {
chunks = chunks.filter(c => !(c instanceof diskchunk_1.DiscardDiskChunk));
chunks = chunks.filter((c) => !(c instanceof diskchunk_1.DiscardDiskChunk));
}
const intersections = [];
chunks.forEach(c => {
chunks.forEach((c) => {
const inter = interval_intersection_1.intervalIntersection(interval, c.interval());

@@ -292,5 +286,5 @@ if (inter !== null) {

readAccordingToPlan(buffer, plan) {
return __awaiter(this, void 0, void 0, function* () {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
let offset = 0;
yield Bluebird.each(plan, (entry) => __awaiter(this, void 0, void 0, function* () {
yield Bluebird.each(plan, (entry) => tslib_1.__awaiter(this, void 0, void 0, function* () {
if (entry instanceof diskchunk_1.DiskChunk) {

@@ -323,3 +317,3 @@ const data = entry.data();

_getCapacity() {
return __awaiter(this, void 0, void 0, function* () {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const stats = yield fs.fstat(this.fd);

@@ -330,3 +324,3 @@ return stats.size;

_read(buffer, bufferOffset, length, fileOffset) {
return __awaiter(this, void 0, void 0, function* () {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
return yield fs.read(this.fd, buffer, bufferOffset, length, fileOffset);

@@ -336,3 +330,3 @@ });

_write(buffer, bufferOffset, length, fileOffset) {
return __awaiter(this, void 0, void 0, function* () {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
return yield fs.write(this.fd, buffer, bufferOffset, length, fileOffset);

@@ -342,3 +336,3 @@ });

_flush() {
return __awaiter(this, void 0, void 0, function* () {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
yield fs.fdatasync(this.fd);

@@ -355,3 +349,3 @@ });

_getCapacity() {
return __awaiter(this, void 0, void 0, function* () {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
return this.buffer.length;

@@ -361,3 +355,3 @@ });

_read(buffer, bufferOffset, length, fileOffset) {
return __awaiter(this, void 0, void 0, function* () {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const bytesRead = this.buffer.copy(buffer, bufferOffset, fileOffset, fileOffset + length);

@@ -368,3 +362,3 @@ return { buffer, bytesRead };

_write(buffer, bufferOffset, length, fileOffset) {
return __awaiter(this, void 0, void 0, function* () {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const bytesWritten = buffer.copy(this.buffer, fileOffset, bufferOffset, bufferOffset + length);

@@ -375,3 +369,3 @@ return { buffer, bytesWritten };

_flush() {
return __awaiter(this, void 0, void 0, function* () {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
// Nothing to do to flush a BufferDisk

@@ -378,0 +372,0 @@ });

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.intervalIntersection = void 0;
function intervalIntersection(a, b) {

@@ -4,0 +5,0 @@ const start = Math.max(a[0], b[0]);

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRanges = void 0;
const tslib_1 = require("tslib");
function* mapIterable(source, transform) {

@@ -17,3 +11,3 @@ for (const value of source) {

function getNotDiscardedIntervals(disk) {
return __awaiter(this, void 0, void 0, function* () {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
return notDiscardedIntervalsIterator(disk.getDiscardedChunks(), yield disk.getCapacity());

@@ -54,3 +48,3 @@ });

function getRanges(disk, blockSize) {
return __awaiter(this, void 0, void 0, function* () {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const intervals = yield getNotDiscardedIntervals(disk);

@@ -57,0 +51,0 @@ const blockSizedIntervals = mapIterable(intervals, (chunk) => [

@@ -7,4 +7,11 @@ # Change Log

## 6.0.1 - 2019-04-05
# v6.0.2
## (2020-07-14)
* Update dependencies [Alexis Svinartchouk]
* Update resin-lint -> balena-lint [Alexis Svinartchouk]
* Use tslib [Alexis Svinartchouk]
## 6.0.1 - 2019-04-04
* Add an overlapping discard test [Alexis Svinartchouk]

@@ -11,0 +18,0 @@ * Fix readme: remove getBlockMap, add GetRanges [Alexis Svinartchouk]

{
"name": "file-disk",
"version": "6.0.1",
"version": "6.0.2-tslib-e118190a2547a7003f2fc15bb430812078618551",
"description": "Handles reads / writes on disk image files.",

@@ -24,4 +24,4 @@ "author": "Petros Angelatos <petrosagg@balena.io>",

"prepublishOnly": "npm run compile",
"prettier": "prettier --config ./node_modules/resin-lint/config/.prettierrc --write \"src/*.ts\" \"test/*.ts\"",
"lint": "resin-lint --typescript src test && tsc --noEmit",
"prettier": "balena-lint --typescript --fix src test",
"lint": "balena-lint --typescript src test && tsc --noEmit",
"test": "npm run lint && mocha --require ts-node/register test/*.ts"

@@ -36,13 +36,14 @@ },

"devDependencies": {
"@types/bluebird": "^3.5.24",
"@types/mocha": "^5.2.5",
"@types/node": "^6.0.118",
"mocha": "^6.0.2",
"resin-lint": "^3.0.1",
"ts-node": "^8.0.3",
"typescript": "^3.1.6"
"@balena/lint": "^5.1.0",
"@types/bluebird": "^3.5.32",
"@types/mocha": "^8.0.0",
"@types/node": "^6.14.10",
"mocha": "^8.0.1",
"ts-node": "^8.10.2",
"typescript": "^3.9.6"
},
"dependencies": {
"bluebird": "^3.5.3"
"bluebird": "^3.7.2",
"tslib": "^2.0.0"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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