Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
SED doing wrong in binary hex file. #928
Comments
|
Does unix |
|
You might also find parts of the discussion on #645 to be interesting, although it seems this is an issue with input type validation, not with data corruption (so, clearly not a duplicate issue). |
Node version (or tell us if you're using electron or some other framework):
v11.6.0
ShellJS version (the most recent version/Github branch you see the bug on):
shelljs@0.8.3
Operating system:
MacOS 10.14.2
Description of the bug:
Failing att using SED and hex
Example ShellJS command to reproduce the error:
var shell = require('shelljs');
find = Buffer.from('FF0090', 'hex');
replace = Buffer.from('BBCC10', 'hex');
console.log (find.toString('ascii'));
console.log (replace.toString('ascii'));
shell.sed('-i', find , replace.toString('ascii'), 'test.bin');
test.bin before operation in hex
FF0090
test.bin after operation in hex
3B4C10
The testbin should contain in hex
BBCC10
Also tryed
shell.sed('-i', find , replace, 'test.bin');
But that gives me error:
"sed: invalid replacement string"