# onedrive-fetch

> Fetches and returns children's json data (ex: name and URL) from a public OneDrive folder using the OneDrive API.

Latest version **4.0.2** (published 2023-02-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install onedrive-fetch
pnpm add onedrive-fetch
yarn add onedrive-fetch
bun add onedrive-fetch
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.2 |
| Published | 2023-02-14 |
| First published | 2023-02-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Maintainers | morganshaner |
| Keywords | onedrive, fetch, children, folder, share |

## Links

- npm: https://www.npmjs.com/package/onedrive-fetch
- Repository: https://github.com/morganshaner/onedrive-fetch
- Homepage: https://github.com/morganshaner/onedrive-fetch#readme
- Issues: https://github.com/morganshaner/onedrive-fetch/issues
- npm.io page: https://npm.io/package/onedrive-fetch

## Alternatives

- [gamedig](https://npm.io/package/gamedig.md) — 29.3K weekly downloads
- [join-monster](https://npm.io/package/join-monster.md) — 12.8K weekly downloads
- [masked](https://npm.io/package/masked.md) — 5.5K weekly downloads
- [@comunica/actor-query-process-explain-logical](https://npm.io/package/@comunica/actor-query-process-explain-logical.md) — 4.7K weekly downloads
- [@veracity/vui](https://npm.io/package/@veracity/vui.md) — 4.6K weekly downloads

## Recent versions

- 4.0.2 (latest) — 2023-02-14
- 4.0.1 — 2023-02-14
- 4.0.0 — 2023-02-12
- 3.0.0 — 2023-02-12
- 2.0.0 — 2023-02-12
- 1.0.0 — 2023-02-12

## README

# onedrive-fetch

Fetches and returns children's json data (ex: name and URL) from a public OneDrive folder using the OneDrive API.

## Install

```
$ npm install onedrive-fetch
```

## Usage

The following example returns children's data (files/folders) in the OneDrive location ".../Root/Folder/Sub-folder".

```js
const odfetch = require("onedrive-fetch");

odfetch("https://1drv.ms/u/s!AsOBq5tE-6XDgZpN9uwZG5iZWGi3vw", //Required OneDrive root folder share URL
        ["Folder", "Sub-folder"]) //Optional array of sub-folder names to open
  .then( //Note this is asynchronous
    function (result) {
      if (result.error) {
        
        //Handle errors
        console.log(result);
      } else {
      
        //Handle successful fetch
        result.forEach((item) => {
          console.log({ name: item.name, url: item.webUrl });
        });
        //FYI: OneDrive API returns an array of child objects
        
        //Example log
        //{ "name": "File 1.jpg", "url": "https://1drv.ms/i/s!AsOBq5tE-6XDgZpQ9uwZG5iZWGi3vw" }
        //{ "name": "File 2.jpg", "url": "https://1drv.ms/i/s!AsOBq5tE-6XDgZpR9uwZG5iZWGi3vw" }
      }
  }
);
```

---
_Source: https://npm.io/package/onedrive-fetch · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
