v1.1.0: update urls

This commit is contained in:
AJ ONeal 2019-10-19 23:06:51 -06:00
parent a8af9bb209
commit 71aa9815e8
4 changed files with 37 additions and 41 deletions

View File

@ -1,4 +1,4 @@
# @root/hexdump # [hexdump.js](https://git.rootprojects.org/root/hexdump.js)
| Built by [Root](https://rootprojects.org) | Built by [Root](https://rootprojects.org)
@ -12,45 +12,51 @@ For example, the text of "Hello, World!\n" looks something like this:
000000e 000000e
``` ```
## Usage # Usage
So far it just does one thing: print an ArrayBuffer in hex, with a header: So far it just does one thing: print an ArrayBuffer in hex, with a header:
### JavaScript ## Node.js (and WebPack)
```bash ```bash
var hexdump = require('@root/hexdump').hexdump; var hexdump = require('hexdump.js').hexdump;
var str = hexdump(new Uint8Array([ 0, 1, 2, 127, 254, 255 ])); var str = hexdump(new Uint8Array([ 0, 1, 2, 127, 254, 255 ]));
console.log(str); console.log(str);
``` ```
### Browser ## Vanilla JS (Browser)
```html
<script src="https://unpkg.com/@root/hexdump/dist/hexdump.js"></script>
```
```html
<script src="https://unpkg.com/@root/hexdump/dist/hexdump.min.js"></script>
```
```javascript ```javascript
console.log(window.hexdump(new Uint8Array([0, 1, 2, 127, 254, 255]))); console.log(window.hexdump(new Uint8Array([0, 1, 2, 127, 254, 255])));
``` ```
### CLI ## CLI
```bash ```bash
hexdump.js <filepath> hexdump.js <filepath>
``` ```
## Install # Install
Centralized:
```bash ```bash
# As a library # As a library
npm install --save @root/hexdump npm install --save @hexdump.js
# As a global CLI (useful on windows) # As a global CLI (useful on windows)
npm install --global @root/hexdump npm install --global @hexdump.js
``` ```
## API # API
```js ```js
hexdump(arrayBuffer, byteOffset, byteLength); hexdump(arrayBuffer, byteOffset, byteLength);

View File

@ -1,30 +1,4 @@
#!/usr/bin/env node #!/usr/bin/env node
'use strict'; 'use strict';
var hexdump = require('../'); require('@root/hexdump/bin/cli.js');
var fsname = process.argv[2];
var fs = require('fs');
var opts = {};
if (!fsname || '--help' === fsname || '-h' === fsname) {
console.error('Usage: hexdump.js -C <filepath>');
process.exit(2);
return;
}
if ('-C' === fsname) {
opts.C = true;
fsname = process.argv[3];
}
try {
fs.statSync(fsname);
} catch (e) {
console.error(e.message);
process.exit(3);
return;
}
var nb = fs.readFileSync(fsname);
var str = hexdump(nb.buffer, nb.byteOffset, nb.byteLength, opts);
console.info(str);

13
package-lock.json generated Normal file
View File

@ -0,0 +1,13 @@
{
"name": "hexdump.js",
"version": "1.1.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@root/hexdump": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@root/hexdump/-/hexdump-1.1.0.tgz",
"integrity": "sha512-D0KpG8OkJUEP2GixkIjjLoB9P6t2KruAirnmKL5utT1Ma16S26vwG4ibLVBqG6rySaUDaCx7YMRH+5zzZS5jQw=="
}
}
}

View File

@ -1,5 +1,5 @@
{ {
"name": "@root/hexdump", "name": "hexdump.js",
"version": "1.1.0", "version": "1.1.0",
"description": "Like hexdump on *nix, but in JavaScript.", "description": "Like hexdump on *nix, but in JavaScript.",
"main": "hexdump.js", "main": "hexdump.js",
@ -21,5 +21,8 @@
"js" "js"
], ],
"author": "AJ ONeal <coolaj86@gmail.com> (https://coolaj86.com)", "author": "AJ ONeal <coolaj86@gmail.com> (https://coolaj86.com)",
"license": "MPL-2.0" "license": "MPL-2.0",
"dependencies": {
"@root/hexdump": "^1.1.0"
}
} }