Package of utils to get bing daily wallpaper and set it as wallpaper to your PC.
$ npm install --save bingpaper
//only for CommonJS
//create test.js
const bingUtils = require('bingpaper');
bingUtils.setWallpaper();
//in terminal
node test
and you will find your wallpaper on desktop changed to lastest bing wallpaper.
the picture is stored in C:\Users\Administrator\Pictures
in default
here, I offer some useful utils for you.
- get information about bing wallpaper, including urls of these pictures
bingUtils.featchPicInfo(options, callback)
parameters | type | required | default | others |
---|---|---|---|---|
options | Object | No | {} | for options parameters |
options.n | Number | No | 1 | maximum is 7,download numbers of pictures |
options.format | String | No | 'js' | request format, don't change |
options.ids | number | No | 0 | I don't know, don't change |
callback | Function | Yes | default contains image info, type of this parameter is Array |
- get picture urls
bingUtils.featchPicURLs(options, callback)
parameters | type | required | default | others |
---|---|---|---|---|
options | Object | No | {} | for options parameters |
options.n | Number | No | 1 | maximum is 7,download numbers of pictures |
options.format | String | No | 'js' | request format, don't change |
options.ids | number | No | 0 | I don't know, don't change |
callback | Function | Yes | default contains urls, type of this parameter is Object |
- download these pictures
bingUtils.downloadPic(url, options, callback)
parameters | type | required | default | others |
---|---|---|---|---|
url | String | Yes | a url to download a picture | |
options | Object | No | {} | for options parameters |
options.name | String | No | date of this day | give a name for your picture |
options.path | String | No | C:\Users\Administrator\Pictures | where you save your picture |
callback | Function | Yes | when you finish download your picture |
- straightly set your desktop wallpaper as today's bing wallpaper
bingUtils.setWallpaper()