# use of minio library in notebook

**URL:** <https://talk.observablehq.com/t/use-of-minio-library-in-notebook/9934>\
**Category:** Help\
**Created:** [October 20, 2024, 12:28pm UTC](https://talk.observablehq.com/t/use-of-minio-library-in-notebook/9934 "2024-10-20T12:28:42Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![espinielli](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/espinielli/32/142_2.png) [@espinielli](https://talk.observablehq.com/u/espinielli)\
**Post date:** [October 20, 2024, 12:28pm UTC](https://talk.observablehq.com/t/use-of-minio-library-in-notebook/9934/1 "2024-10-20T12:28:42Z")

</div>

I would like to access some data served by MinIO (I have access/private keys).

I have been trying to require [minio](https://www.npmjs.com/package/minio) in Observable notebooks, but it is really a stubborn library (and I am probably not knowledgeable enough)!

I have tried:

1. `require("minio")` which fails (if you use `require.resolve("minio")` it gives `"https://cdn.observableusercontent.com/npm/minio@8.0.1/dist/main/minio.js"`)
2. then I used the notebook [“Module require debugger”](https://observablehq.com/@observablehq/module-require-debugger) which gave as a suggestion `require('minio@8.0.1/dist/main/minio.js').catch(() => window["_exportNames"])` which fails too
3. then from [How to require stubborn modules](https://observablehq.com/documentation/debugging/require-stubborn-modules) I’ve also given a try to `require('https://bundle.run/minio@8.0.1')` which fails too

I am out of alternative resources to try…  
Anybody with suggestions?

---

<div class="post-metadata">

**Author:** ![mootari](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/mootari/32/581_2.png) [@mootari](https://talk.observablehq.com/u/mootari)\
**Post date:** [October 20, 2024, 9:27pm UTC](https://talk.observablehq.com/t/use-of-minio-library-in-notebook/9934/2 "2024-10-20T21:27:39Z")

</div>

esm.sh usually does a decent job of bundling browser shims for Node APIs:

```auto
import("https://esm.sh/minio")

```

If the API is truly S3 compatible then you could alternatively take a look at aws4fetch:

> **[aws4fetch](https://www.npmjs.com/package/aws4fetch)**
>
> A compact AWS client for modern JS environments. Latest version: 1.0.20, last published: 2 months ago. Start using aws4fetch in your project by running \`npm i aws4fetch\`. There are 49 other projects in the npm registry using aws4fetch.

---

<div class="post-metadata">

**Author:** ![Cobus](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/cobus/32/9670_2.png) [@Cobus](https://talk.observablehq.com/u/Cobus)\
**Post date:** [October 20, 2024, 9:52pm UTC](https://talk.observablehq.com/t/use-of-minio-library-in-notebook/9934/3 "2024-10-20T21:52:51Z")

</div>

I see there is [an open issue](https://github.com/minio/minio-js/issues/1259) requesting a version that can be used in a browser.

For S3 access you may want to look at this template: [AWS S3 API Starter / Observable | Observable](https://observablehq.com/@observablehq/aws-s3-api-starter)

---

<div class="post-metadata">

**Author:** ![Cobus](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/cobus/32/9670_2.png) [@Cobus](https://talk.observablehq.com/u/Cobus)\
**Post date:** [October 20, 2024, 10:07pm UTC](https://talk.observablehq.com/t/use-of-minio-library-in-notebook/9934/4 "2024-10-20T22:07:18Z")

</div>

I would be curious if the `esm.sh` solution works for you. I tried it but get this error:

 ![Screenshot 2024-10-20 at 3.05.46 PM](https://canada1.discourse-cdn.com/flex030/uploads/observablehq/original/2X/2/292833e471218d9276d707967a807fa74df8df05.png)

But I was able to access the bucket using the template I shared above.

---

<div class="post-metadata">

**Author:** ![espinielli](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/espinielli/32/142_2.png) [@espinielli](https://talk.observablehq.com/u/espinielli)\
**Post date:** [October 22, 2024, 2:47pm UTC](https://talk.observablehq.com/t/use-of-minio-library-in-notebook/9934/5 "2024-10-22T14:47:43Z")

</div>

No success with your template for MinIO…unfortunately

---

<div class="post-metadata">

**Author:** ![espinielli](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/espinielli/32/142_2.png) [@espinielli](https://talk.observablehq.com/u/espinielli)\
**Post date:** [October 22, 2024, 2:53pm UTC](https://talk.observablehq.com/t/use-of-minio-library-in-notebook/9934/6 "2024-10-22T14:53:17Z")

</div>

yeah, esm.sh didn’t work for me too

---

<div class="post-metadata">

**Author:** ![tomlarkworthy](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/tomlarkworthy/32/5940_2.png) [@tomlarkworthy](https://talk.observablehq.com/u/tomlarkworthy)\
**Post date:** [October 22, 2024, 9:21pm UTC](https://talk.observablehq.com/t/use-of-minio-library-in-notebook/9934/7 "2024-10-22T21:21:47Z")

</div>

Sorta related but sorta not, I have a half finished observable notebook connecting with Backblaze, R2 and minio here [mps3 - Offline-first DB over S3-compatible storage / Tom Larkworthy | Observable](https://observablehq.com/@tomlarkworthy/mps3-vendor-examples) but it uses my own home rolled library. minio works with any S3 client, so I would go the route cobus suggested, just consider it an S3 client, the AWS S3 browser client can connect to it fine. I have done the aws4fetch route before and its awesome for perf and bundle size but you have to decode S3’s baroque and broken XML so its only for niche use, not general purpose IMHO
