I'm trying to retrieve the list of images that a onenote page has. When I get the page content, an HTML, images have a source of the form:
https://www.onenote.com/api/beta/resources/{id}/$value
Doing a get over that url I get the following headers:
{
'cache-control': 'no-cache',
pragma: 'no-cache',
'content-type': 'application/octet-stream',
expires: '-1',
server: 'Microsoft-IIS/8.0',
'x-correlationid': '38283de4-110c-4c17-a371-c950c88025de',
'x-usersessionid': '38283de4-110c-4c17-a371-c950c88025de',
'x-officefe': 'OneNoteServiceFrontEnd_IN_2',
'x-officeversion': '16.0.3429.1562',
'x-officecluster': 'eus-www.onenote.com',
p3p: 'CP="CAO DSP COR ADMa DEV CONi TELi CUR PSA PSD TAI IVDi OUR SAMi BUS DEM NAV STA UNI COM INT PHY ONL FIN PUR"',
'x-content-type-options': 'nosniff',
'request-processing-time': '31.2529 ms',
'content-disposition': 'attachment',
'preference-applied': 'odata.include-annotations=*',
'x-aspnet-version': '4.0.30319',
'x-powered-by': 'ASP.NET',
date: 'Sat, 01 Nov 2014 00:17:25 GMT',
'content-length': '10672'
}
and the body of that response is a big binary.
I'm doing this with a Node Js app.
Could someone give me an sample of how to save the response into a image file, like a png or jpeg? Thanks in advance