partitioninfo
Advanced tools
Comparing version 5.0.0 to 5.1.0-allow-buffers-5df965199be1cde47c287cf8490b1dd9c123a2a9
@@ -0,2 +1,4 @@ | ||
/// <reference types="node" /> | ||
import { Disk } from 'file-disk'; | ||
import { TypedError } from 'typed-error'; | ||
export interface MBRPartition { | ||
@@ -21,2 +23,5 @@ offset: number; | ||
}; | ||
export declare class PartitionNotFound extends TypedError { | ||
constructor(partitionNumber: number); | ||
} | ||
/** | ||
@@ -27,3 +32,3 @@ * @summary Get information from a partition | ||
* | ||
* @param {String|filedisk.Disk} image - image path or filedisk.Disk instance | ||
* @param {String|Buffer|filedisk.Disk} image - image path or buffer or filedisk.Disk instance | ||
* @param {Object} number - partition number | ||
@@ -41,3 +46,3 @@ * | ||
*/ | ||
export declare function get(disk: string | Disk, partitionNumber: number): Promise<MBRPartition | GPTPartition>; | ||
export declare function get(disk: string | Buffer | Disk, partitionNumber: number): Promise<MBRPartition | GPTPartition>; | ||
/** | ||
@@ -62,3 +67,3 @@ * @summary Read all partition tables from a disk image recursively. | ||
* | ||
* @param {String|filedisk.Disk} image - image path or filedisk.Disk instance | ||
* @param {String|Buffer|filedisk.Disk} image - image path or buffer or filedisk.Disk instance | ||
* @param {Object} options | ||
@@ -83,3 +88,3 @@ * @param {Number} [options.offset=0] - where the first partition table will be read from, in bytes | ||
*/ | ||
export declare function getPartitions(disk: string | Disk, { offset, includeExtended, getLogical, }?: { | ||
export declare function getPartitions(disk: string | Buffer | Disk, { offset, includeExtended, getLogical, }?: { | ||
offset?: number; | ||
@@ -86,0 +91,0 @@ includeExtended?: boolean; |
@@ -117,2 +117,3 @@ "use strict"; | ||
} | ||
exports.PartitionNotFound = PartitionNotFound; | ||
function getPartition(disk, partitionNumber) { | ||
@@ -163,11 +164,14 @@ return __awaiter(this, void 0, void 0, function* () { | ||
} | ||
function callWithDisk(fn, pathOrDisk, arg) { | ||
function callWithDisk(fn, pathOrBufferOrDisk, arg) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (isString(pathOrDisk)) { | ||
return yield bluebird_1.using(file_disk_1.openFile(pathOrDisk, 'r'), (fd) => __awaiter(this, void 0, void 0, function* () { | ||
if (isString(pathOrBufferOrDisk)) { | ||
return yield bluebird_1.using(file_disk_1.openFile(pathOrBufferOrDisk, 'r'), (fd) => __awaiter(this, void 0, void 0, function* () { | ||
return yield fn(new file_disk_1.FileDisk(fd), arg); | ||
})); | ||
} | ||
else if (Buffer.isBuffer(pathOrBufferOrDisk)) { | ||
return yield fn(new file_disk_1.BufferDisk(pathOrBufferOrDisk), arg); | ||
} | ||
else { | ||
return yield fn(pathOrDisk, arg); | ||
return yield fn(pathOrBufferOrDisk, arg); | ||
} | ||
@@ -181,3 +185,3 @@ }); | ||
* | ||
* @param {String|filedisk.Disk} image - image path or filedisk.Disk instance | ||
* @param {String|Buffer|filedisk.Disk} image - image path or buffer or filedisk.Disk instance | ||
* @param {Object} number - partition number | ||
@@ -220,3 +224,3 @@ * | ||
* | ||
* @param {String|filedisk.Disk} image - image path or filedisk.Disk instance | ||
* @param {String|Buffer|filedisk.Disk} image - image path or buffer or filedisk.Disk instance | ||
* @param {Object} options | ||
@@ -223,0 +227,0 @@ * @param {Number} [options.offset=0] - where the first partition table will be read from, in bytes |
@@ -7,2 +7,6 @@ # Change Log | ||
## 5.1.0 - 2018-12-21 | ||
* Get and getPartitions now accept Buffers as first parameter [Alexis Svinartchouk] | ||
## 5.0.0 - 2018-12-21 | ||
@@ -9,0 +13,0 @@ |
{ | ||
"name": "partitioninfo", | ||
"version": "5.0.0", | ||
"version": "5.1.0-allow-buffers-5df965199be1cde47c287cf8490b1dd9c123a2a9", | ||
"description": "Get information about a partition from an image file", | ||
@@ -54,3 +54,3 @@ "main": "build/partitioninfo.js", | ||
"bluebird": "^3.5.3", | ||
"file-disk": "^5.0.0", | ||
"file-disk": "^5.1.0", | ||
"gpt": "^2.0.0", | ||
@@ -57,0 +57,0 @@ "mbr": "^1.1.3", |
@@ -39,3 +39,3 @@ partitioninfo | ||
| --- | --- | --- | | ||
| image | <code>String</code> \| <code>filedisk.Disk</code> | image path or filedisk.Disk instance | | ||
| image | <code>String</code> \| <code>Buffer</code> \| <code>filedisk.Disk</code> | image path or buffer or filedisk.Disk instance | | ||
| number | <code>Object</code> | partition number | | ||
@@ -80,3 +80,3 @@ | ||
| --- | --- | --- | --- | | ||
| image | <code>String</code> \| <code>filedisk.Disk</code> | | image path or filedisk.Disk instance | | ||
| image | <code>String</code> \| <code>Buffer</code> \| <code>filedisk.Disk</code> | | image path or buffer or filedisk.Disk instance | | ||
| options | <code>Object</code> | | | | ||
@@ -83,0 +83,0 @@ | [options.offset] | <code>Number</code> | <code>0</code> | where the first partition table will be read from, in bytes | |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
37516
342
1
Updatedfile-disk@^5.1.0