0
我轉換從API接收到一個文件對象字節數組文件,使用以下代碼:字節數組中Appcelerator的
var buffer = [73,109,112,111,114,116,115,32,83,121,115,116,101,....];//byte array
var outBuffer = Ti.createBuffer({length: size });
for(var i=0;i<size;i++){
outBuffer[i] = buffer[i];
}
var inBufferStream = Ti.Stream.createStream({ source: outBuffer, mode: Ti.Stream.MODE_READ });
var outFileStream = Ti.Filesystem.getFile("test.txt").open(Ti.Filesystem.MODE_WRITE);
var bytesWritten = Ti.Stream.writeStream(inBufferStream, outFileStream, 1024);
outFileStream.close();
它需要太多的時間來創建該文件。
有沒有更好的方法在appcelerator中做到這一點?請幫忙。