Skip to content

Commit d1aaa92

Browse files
committed
Force binary encoding in download
1 parent 8e882cb commit d1aaa92

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

downloadCurrentVersion.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function getVersionList (cb) {
2828
function downloadBinary (outputName, version, expectedHash) {
2929
console.log('Downloading version', version);
3030

31-
var file = fs.createWriteStream(outputName);
31+
var file = fs.createWriteStream(outputName, { encoding: 'binary' });
3232
https.get('https://ethereum.github.io/solc-bin/bin/' + version, function (response) {
3333
if (response.statusCode !== 200) {
3434
console.log('Error downloading file: ' + response.statusCode);
@@ -37,7 +37,7 @@ function downloadBinary (outputName, version, expectedHash) {
3737
response.pipe(file);
3838
file.on('finish', function () {
3939
file.close(function () {
40-
var hash = '0x' + ethJSUtil.sha3(fs.readFileSync(outputName)).toString('hex');
40+
var hash = '0x' + ethJSUtil.sha3(fs.readFileSync(outputName, { encoding: 'binary' })).toString('hex');
4141
if (expectedHash !== hash) {
4242
console.log('Hash mismatch: ' + expectedHash + ' vs ' + hash);
4343
process.exit(1);

0 commit comments

Comments
 (0)