Get unlimited public & private packages + team-based management with npm Teams.Learn more »

is-rpm

2.0.0 • Public • Published

is-rpm

NPM version Build Status

Check if a Buffer/Uint8Array is a RPM package.

Install

$ npm install --save is-rpm

Usage

Node.js

var readChunk = require('read-chunk'); // npm install read-chunk
var isRpm = require('is-rpm');
var buffer = readChunk.sync('unicorn.rpm', 0, 4);
 
isRpm(buffer);
//=> true

Browser

var xhr = new XMLHttpRequest();
xhr.open('GET', 'unicorn.rpm');
xhr.responseType = 'arraybuffer';
 
xhr.onload = function () {
    isRpm(new Uint8Array(this.response));
    //=> true
};
 
xhr.send();

API

isRpm(buffer)

Accepts a Buffer (Node.js) or Uint8Array.

It only needs the first 4 bytes.

License

MIT © t1st3

Install

npm i is-rpm

DownloadsWeekly Downloads

1

Version

2.0.0

License

MIT

Unpacked Size

2.88 kB

Total Files

4

Last publish

Collaborators

  • avatar