Comparing version 0.1.0 to 0.1.2
@@ -0,1 +1,2 @@ | ||
// BlobInfo <https://github.com/jshq/blobinfo> | ||
"use strict"; | ||
@@ -2,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
// BlobInfo <https://github.com/kobalicek/blobinfo> | ||
// BlobInfo <https://github.com/jshq/blobinfo> | ||
(function(blobinfo) { | ||
@@ -185,3 +185,3 @@ "use strict"; | ||
height = reader.read32LE(data, 22); | ||
bpp = reader.read32LE(data, 28); | ||
bpp = reader.read16LE(data, 28); | ||
} | ||
@@ -188,0 +188,0 @@ |
{ | ||
"name": "blobinfo", | ||
"version": "0.1.0", | ||
"version": "0.1.2", | ||
@@ -24,5 +24,5 @@ "description": "Lightweight library designed for inspecting blobs, mostly for getting image properties.", | ||
"homepage": "https://github.com/kobalicek/blobinfo", | ||
"homepage": "https://github.com/jshq/blobinfo", | ||
"bugs": { | ||
"url": "https://github.com/kobalicek/blobinfo/issues" | ||
"url": "https://github.com/jshq/blobinfo/issues" | ||
}, | ||
@@ -49,3 +49,3 @@ | ||
"type": "git", | ||
"url": "https://github.com/kobalicek/blobinfo.git" | ||
"url": "https://github.com/jshq/blobinfo.git" | ||
}, | ||
@@ -52,0 +52,0 @@ |
@@ -6,7 +6,5 @@ BlobInfo | ||
Official Repository | ||
------------------- | ||
* [Official Repository (jshq/blobinfo)](https://github.com/jshq/blobinfo) | ||
* [Unlicense] (http://unlicense.org) | ||
https://github.com/kobalicek/blobinfo | ||
Introduction | ||
@@ -19,2 +17,4 @@ ------------ | ||
BlobInfo can be considered as a high-performance library. It doesn't create any temporary objects while inspecting, it doesn't use `Buffer.slice()` or `String.substr()` to get a part of inspected buffer and it tries to bail out as fast as possible to not waste time on inspecting something that will fail at later phase. | ||
Usage | ||
@@ -61,7 +61,7 @@ ----- | ||
{ | ||
"type" : "image", | ||
"mime" : ["image/png"], | ||
"extension: [".png"], | ||
"width" : 32, | ||
"height" : 8 | ||
"type" : "image", | ||
"mime" : ["image/png"], | ||
"extension": [".png"], | ||
"width" : 32, | ||
"height" : 8 | ||
} | ||
@@ -73,7 +73,7 @@ ``` | ||
```JS | ||
console.log(blobinfo.inspect(buffer, ["images/png", "image/jpeg"])); // Outputs the same... | ||
console.log(blobinfo.inspect(buffer, ["images/bmp", "image/jpeg"])); // Outputs `null`. | ||
console.log(blobinfo.inspect(buffer, ["images/png", "image/jpeg"])); // Success. | ||
console.log(blobinfo.inspect(buffer, ["images/bmp", "image/jpeg"])); // Failure. | ||
``` | ||
The first call to inspec in the code above returns exactly the same object as in the first example, however, the second call returns `null`, because `PNG` data doesn't match `BMP` or `JPEG` signature. | ||
The first call to `inspect` in the code above returns exactly the same object as in the first example, however, the second call returns `null`, because `PNG` data doesn't match `BMP` or `JPEG` signature. | ||
@@ -107,3 +107,3 @@ Supported File Types | ||
The `inspect()` function is the most interesting. It accepts `reader` and `data` parameters. The `reader` is an instance of `BufferReader` or `StringReader`, both private objects not accessible outside of `BlobInfo`, which is used to access bytes stored in `data`. Reader is basically an interface to access `String` or `Buffer` without having to worry about the data type. | ||
The most interesting part is the `inspect()` function. It accepts `reader` and `data` parameters. The `reader` is an instance of `BufferReader` or `StringReader`, both private objects not accessible outside of `BlobInfo`, which is used to access bytes stored in `data`. Reader is basically an interface to access `String` or `Buffer` without having to worry about the data type. | ||
@@ -124,5 +124,5 @@ The `reader` object provides the following methods: | ||
Methods, which starts with `read` are used to read BYTE, WORD or DWORD depending on suffix and endianness. Function equals is used to compare bytes in `data` starting from `offset` against `pattern` (pattern can be `Array` of bytes or `Buffer`, but not `String`). | ||
Methods, which starts with `read` are used to read BYTE, WORD or DWORD depending on suffix and endianness. Function `equals` is used to compare bytes in `data` starting from `offset` against `pattern` (pattern can be `Array` of bytes or `Buffer`, but not `String`). | ||
Adding a new, global, inspector is possible through `addInspector()` function. Following example shows how to create a new inspector for inspecting a `PCX` file and to plug it dynamically to the global inspectors list: | ||
Adding a new, global, inspector is possible through `addInspector()` function. The following example shows how to create a new inspector for inspecting a `PCX` file and to how add it dynamically to the global inspectors list: | ||
@@ -165,4 +165,4 @@ ``` | ||
type: "image", | ||
mime: "application/pcx", | ||
extension: ".pcx", | ||
mime: ["application/pcx"], | ||
extension: [".pcx"], | ||
@@ -179,6 +179,1 @@ // Leading byte, not required, but helps to determine the file type faster | ||
Please note that PCX is not part of files recognized by BlobInfo. It's just an example, which tries to explain the concept on something that is working. | ||
License | ||
------- | ||
BlobInfo follows [Unlicense](http://unlicense.org/). |
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 bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
34252
7
593
172