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

is-png

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-png - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

13

index.d.ts

@@ -10,13 +10,16 @@ /**

// Node.js:
import readChunk from 'read-chunk';
import {readChunk} from 'read-chunk';
import isPng from 'is-png';
const buffer = readChunk.sync('unicorn.png', 0, 8);
const buffer = await readChunk('unicorn.png', {length: 8});
isPng(buffer);
//=> true
```
@example
```
import isPng from 'is-png';
// Browser:
import readChunk from 'read-chunk';
const response = await fetch('unicorn.png');

@@ -29,2 +32,2 @@ const buffer = await response.arrayBuffer();

*/
export default function isPng(buffer: Uint8Array | Buffer): boolean;
export default function isPng(buffer: Uint8Array): boolean;

@@ -6,12 +6,10 @@ export default function isPng(buffer) {

return (
buffer[0] === 0x89 &&
buffer[1] === 0x50 &&
buffer[2] === 0x4E &&
buffer[3] === 0x47 &&
buffer[4] === 0x0D &&
buffer[5] === 0x0A &&
buffer[6] === 0x1A &&
buffer[7] === 0x0A
);
return buffer[0] === 0x89
&& buffer[1] === 0x50
&& buffer[2] === 0x4E
&& buffer[3] === 0x47
&& buffer[4] === 0x0D
&& buffer[5] === 0x0A
&& buffer[6] === 0x1A
&& buffer[7] === 0x0A;
}
{
"name": "is-png",
"version": "3.0.0",
"version": "3.0.1",
"description": "Check if a Buffer/Uint8Array is a PNG image",

@@ -43,8 +43,8 @@ "license": "MIT",

"devDependencies": {
"@types/node": "^14.14.41",
"@types/node": "^16.7.10",
"ava": "^3.15.0",
"read-chunk": "^3.2.0",
"tsd": "^0.14.0",
"xo": "^0.38.2"
"read-chunk": "^4.0.1",
"tsd": "^0.17.0",
"xo": "^0.44.0"
}
}

@@ -16,6 +16,6 @@ # is-png

```js
import readChunk from 'read-chunk'; // npm install read-chunk
import {readChunk} from 'read-chunk';
import isPng from 'is-png';
const buffer = readChunk.sync('unicorn.png', 0, 8);
const buffer = await readChunk('unicorn.png', {length: 8});

@@ -22,0 +22,0 @@ isPng(buffer);

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