Я хочу сохранить выбранное изображение в файловой системе html5.Проблема в том, что я не знаю, как записать двоичные данные в файловую систему с помощью файла API.Ниже приведены части моего кода:
var reader = new FileReader();
reader.onloadend = function(e)
{
var data = e.target.result;
// Open File System code (Codes Omitted)
// Create file (Codes Omitted)
fileEntry.createWriter(function(fileWriter)
{
// This is the problem, the file is create, something is written to the file
// because the size is exact same with the dragged file (image). But when i
// try to view the file (image), it displays nothing.
var bb = new WebKitBlobBuilder
bb.append(data);
fileWriter.write(bb.getBlob(""));
}
}
reader.readAsBinaryString(cur_file);
Я намеренно пропустил некоторые коды, такие как файловая система и создание файла.Мне нужна только помощь с сохранением двоичных данных.
Спасибо.