The following codes work, but instead of oStream.Read which reads all bytes at once, I want to read it in chunks...what is the api for it? I see there is something "oStream.Read 256" that allows you to read the first 256 bytes, but that is not what I need...
say the file is 1,000,000 bytes, I want to read it 256 bytes at a time... 0-255, 256-511 so on...
oStream = ne开发者_如何学运维w ActiveXObject("ADODB.Stream");
oStream.Type = adTypeBinary;
oStream.Open;
oStream.LoadFromFile(oItem.path);
content = oStream.Read;
thank you
I have just made a test script using your code and as long as I define adTypeBinary
as 1
, substitute oItem.path
for a known filename and use oStream.Read(256), it works as you require. Check to see it you aren't accidentally reloading the file or rewinding the stream. If all else fails, the Position
property should be able to set the next read position for you.
精彩评论