- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbinaryToStream.js
More file actions
Latest commit
17 lines (15 loc) · 451 Bytes
/
Copy pathbinaryToStream.js
File metadata and controls
17 lines (15 loc) · 451 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/*
** Convert a COM binary buffer (bytes array / VT_ARRAY|VT_UI1) contents to a
** COM stream object (IStream), using only components included with Windows.
**
** Dependencies:
** - Microsoft ActiveX Data Objects ("ADODB.Stream")
*/
functionbinaryToStream(binary){
varadostm=newActiveXObject("ADODB.Stream");
adostm.type=1/*adTypeBinary*/;
adostm.open();
adostm.write(binary);
adostm.position=0;
returnadostm;
}