Export to GitHub

v8cgi - issue #89

binary data into filesystem


Posted on Feb 17, 2011 by Helpful Wombat

What steps will reproduce the problem?

var f = new File("c:\a.js") f.open("wb")
f.write([10, 20, 30]) f.close()

What is the expected output? What do you see instead? A file with 3 bytes with values 10 20 30 Array -> toString -> 10,20,30

What version of the product are you using? On what operating system? 0.9.0

Please provide any additional information below. System: Windows Xp Professional

Comment #1

Posted on Feb 17, 2011 by Happy Giraffe

In order to handle binary data, use the new Buffer class, introduced in v8cgi 0.9.0. Your file-writing example can be rewritten like this:

var Buffer = require("binary").Buffer; var binaryData = new Buffer([10, 20, 30]); f.write(binaryData);

Status: Invalid

Labels:
Type-Defect Priority-Medium