Skip to content

Commit ac47d5b

Browse files
Update README.md with download as binary example
1 parent d460a1b commit ac47d5b

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,19 @@ You can pass in additional request headers, either individually or in a dictiona
241241
````
242242

243243
### .responseType()
244-
To set a custom response type, use the `.responseType(string)` method. To see an example, check the [browser sample](samples/browser/index.html) that downloads an image and displays it in an `<img>` element.
244+
To set a custom response type, use the `.responseType(string)` method. Use `.responseType("blob")` to download content as a binary.
245+
````js
246+
client
247+
.api(`/me/drive/root/children/${fileName}/content`)
248+
.responseType("blob")
249+
.get()
250+
.then((res) => {
251+
console.log("Downloaded..!!");
252+
})
253+
.catch((err) => {
254+
throw err;
255+
});
256+
````
245257

246258
## Running node samples
247259
You can run and debug the node samples found under [./samples/node/node-sample.js](./samples/node/node-sample.js) by running the *Run node samples* configuration from the **Debug** (Ctrl + Shift + D) menu in Visual Studio Code. Alternately, you can run the node samples from the CLI by entering `node ./samples/node/node-sample.js` (assuming you are at the root of this repo). You'll need to rename the *secrets.example.json* file to *secrets.json* and add a valid access token to it. You can get an access token by doing the following:

0 commit comments

Comments
 (0)