Socket
Socket
Sign inDemoInstall

hexy

Package Overview
Dependencies
0
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.1 to 0.2.2

.npmignore

40

hexy.js

@@ -48,13 +48,14 @@ //= hexy.js -- utility to create hex dumps

// var format = {}
// format.width = width // how many bytes per line, default 16
// format.numbering = n // ["hex_bytes" | "none"], default "hex_bytes"
// format.format = f // ["fours"|"twos"|"none"], how many nibbles per group
// // default "fours"
// format.caps = c // ["lower"|"upper"], default lower
// format.annotate=a // ["ascii"|"none"], ascii annotation at end of line?
// // default "ascii"
// format.prefix=p // <string> something pretty to put in front of each line
// // default ""
// format.indent=i // <num> number of spaces to indent
// // default 0
// format.width = width // how many bytes per line, default 16
// format.numbering = n // ["hex_bytes" | "none"], default "hex_bytes"
// format.format = f // ["fours"|"twos"|"none"], how many nibbles per group
// // default "fours"
// format.caps = c // ["lower"|"upper"], default lower
// format.annotate=a // ["ascii"|"none"], ascii annotation at end of line?
// // default "ascii"
// format.prefix=p // <string> something pretty to put in front of each line
// // default ""
// format.indent=i // <num> number of spaces to indent
// // default 0
// format.html=true|false// whether to put some divs with classes and somesuch in.
//

@@ -97,2 +98,5 @@ // console.log(hexy.hexy(buffer, format))

//
// Better HTML support, e.g. I'd like to be able to mouse over the ascii
// annotations and highlight the corresponding byte and vice versa.
//
//== History

@@ -139,2 +143,3 @@ //

self.indent = config.indent || 0
self.html = config.html || false

@@ -150,6 +155,7 @@ for (var i = 0; i!=self.indent; ++i) {

if (self.html) { str += "<div class='hexy'>\n"}
//split up into line of max `self.width`
var line_arr = lines()
//lines().forEach(function(hex_raw, i){
//lines().forEach(function(hex_raw, i)
for (var i = 0; i!= line_arr.length; ++i) {

@@ -174,2 +180,7 @@ var hex_raw = line_arr[i],

}
if (self.html) {
odd = i%2 == 0 ? " even" : " odd"
str += "<div class='"+pad(i*self.width, 8)+odd+"'>"
}
str += self.prefix

@@ -199,4 +210,9 @@

}
if (self.html) {
str += "</div>\n"
} else {
str += "\n"
}
}
if (self.html) { str += "</div>\n"}
return str

@@ -203,0 +219,0 @@ }

{
"name" : "hexy",
"version" : "0.2.1",
"version" : "0.2.2",
"description" : "hexdump, binary pretty-printing",

@@ -5,0 +5,0 @@ "author" : "Tim Becker <tim.becker@kuriositaet.de>",

@@ -54,3 +54,9 @@ var hexy = require("./hexy.js")

"dingdong77 78 7A 79 \n"+
""
"",
"<div class='hexy'>\n"+
"<div class='00000000 even'>00000000: 3031 3233 3435 3637 3839 6162 6364 6566 0123456789abcdef</div>\n"+
"<div class='00000010 odd'>00000010: 6768 696a 6b6c 6d6e 6f70 7172 7374 7576 ghijklmnopqrstuv</div>\n"+
"<div class='00000020 even'>00000020: 7778 7a79 wxzy</div>\n"+
"</div>\n",
]

@@ -70,2 +76,3 @@

{caps:"upper", numbering:"none", annotate:"none", prefix:"dingdong", format:"twos"},
{html:true}
]

@@ -72,0 +79,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc