dan-online / bunnycdn-stream Goto Github PK
View Code? Open in Web Editor NEWA simple, lightweight, and easy to use HTTP streaming library for BunnyCDN.
Home Page: https://npmjs.org/package/bunnycdn-stream
License: Apache License 2.0
A simple, lightweight, and easy to use HTTP streaming library for BunnyCDN.
Home Page: https://npmjs.org/package/bunnycdn-stream
License: Apache License 2.0
Could not find a declaration file for module 'bunnycdn-stream'. 'node_modules/bunnycdn-stream/dist/index.mjs' implicitly has an 'any' type.
There are types at 'node_modules/bunnycdn-stream/dist/index.d.ts', but this result could not be resolved when respecting package.json "exports". The 'bunnycdn-stream' library may need to update its package.json or typings.
Install and import the library into a nuxt3 project.
No response
There is an API method that is not implemented in the library: https://docs.bunny.net/reference/video_getvideoplaydata
Can we please add it? I'm asking because after uploading video with createAndUploadVideo()
method, I want to access its url
s and length
to save to my database.
No response
Hello,
I would suggest changing the URL mentioned below to https://vz-123412341234.b-cdn.net/1234-1234-1234-1234-123412341234/play_720p.mp4 as this is more likely to not be deleted compared to the one found here
bunnycdn-stream/tests/Bunny.test.ts
Line 241 in 7acbc32
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
Warning
These dependencies are deprecated:
Datasource | Name | Replacement PR? |
---|---|---|
npm | @types/rimraf |
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
@vitest/coverage-v8
, vitest
).github/workflows/codeql-analysis.yml
actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
github/codeql-action v3@4fa2a7953630fd2f3fb380f21be14ede0169dd4f
github/codeql-action v3@4fa2a7953630fd2f3fb380f21be14ede0169dd4f
github/codeql-action v3@4fa2a7953630fd2f3fb380f21be14ede0169dd4f
.github/workflows/continuous-delivery.yml
actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
.github/workflows/continuous-integration.yml
actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
actions/setup-node v4@1e60f620b9541d16bece96c5465dc8ee9832be0b
actions/cache v4
codecov/codecov-action v4.5.0
.github/workflows/labelssync.yml
actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
crazy-max/ghaction-github-labeler v5@de749cf181958193cb7debf1a9c5bb28922f3e1b
package.json
axios ^1.7.2
@biomejs/biome ^1.8.3
@commitlint/cli ^19.3.0
@commitlint/config-conventional ^19.2.2
@favware/npm-deprecate ^1.0.7
@sapphire/ts-config ^5.0.1
@types/jest ^29.5.12
@types/node ^20.14.10
@types/rimraf ^4.0.5
@vitest/coverage-v8 ^1.6.0
dotenv ^16.4.5
husky ^9.0.11
jest ^29.7.0
jest-circus ^29.7.0
lint-staged ^15.2.7
release-it ^17.6.0
rimraf ^6.0.1
ts-jest ^29.2.2
ts-node ^10.9.2
tsup ^8.1.0
typedoc ^0.26.4
typedoc-plugin-markdown ^4.2.1
typescript ^5.5.3
vitest ^1.6.0
yarn 4.3.1
First of all congrats on your work!
I have some questions.
Again, thanks a lot! This project is awesome!
When you try to use the function createDirectUpload the documentation says that collection
is optional which is correct but the right key should be collectionId
because in the bunny documentation it is the right key used for createVideo
function which is the internal function used in the createDirectUpload
.
createDirectUpload
with the following parameters: title, collection.No response
Hello there, it is me again,
I encountered another bug and wanted to notify you.
When calling listVideos
the provided options do not work as you need to pass them as query params and not within the body of the request.
I just had a look at listVideos
for now so I'm not sure if this is impactful somewhere else.
The LOC I refer to -> https://github.com/dan-online/bunnycdn-stream/blob/main/src/index.ts#L250
How it should be -> https://docs.bunny.net/reference/video_list
You should take advantage of URLSearchParams
something like:
const options = {
page: '1', <-- string
itemsPerPage: '10', <-- string
search: 'hello',
collection: '1312' <-- should rather be collectionId as you search for id and not the name
}
const urlParams = new URLSearchParams(options)
โ๐ผ
Think about this scenario:-
I have a public m3u8 video url and i want to upload it to bunny stream. The thing I've to do now:-
If it is possible to upload m3u8 directly to bunny stream with fetch video api, then it will be super cool!
First things first, thanks so much for building this - super useful tool!
I have quick question - I got a little stuck initially uploading videos, as I was creating a web stream from a File
object (obtained through a POST request from a html form) using File.stream()
. However, despite the bunnycdn-stream API accepting that and returning a response without any issues, the video on the BunnyStream web interface was showing a 'processing failed' error.
I was able to fix things by converting the web stream into a node.js stream using stream.Readable.fromWeb(readable)
.
Do you know if this is an issue on the BunnyStream end of things, or that AXIOS is not tolerating a web stream for some reason?
Thanks!
Hari
I'm using nestjs and I wanted to use createAndUploadVideo
to upload the file. Unfortunately, file must be of ReadStream
type and createReadStream
does not work with buffer
and stream
properties of my multer file. Any ideas how can I make it work?
P.S. Why there is no getVideoPlayData()
method implemented?
...
No response
Hi,
I was trying to compile my TS code into CommonJS and I encountered this error at runtime:
The same error can be reproduced when creating an empty JS project with the library 'file-type'.
It turned out that the library 'file-type' only supports ESM since version 17. However, version 16 (which supports CommonJS) appears to be still maintained.
I made a pull request to address this issue. The change only involves one function related to setting the thumbnail.
I hope my input was useful and happy to provide more info if needed ๐
Hi,
I faced an issue while using Vitest to run some tests that include this library. My code normally compiles to CommonJS and it works fine, only when I use modules the problem occurs.
However, to reproduce this problem you don't actually need to be using TS, you can simply initialize a new npm project and install bunnycdn-stream library. Then set the type parameter in package.json to "module".
npm init -y
npm install bunnycdn-stream
package.json:
// package.json:
"type": "module"
Then create a very simple index.js:
import { BunnyCdnStream } from 'bunnycdn-stream';
const testBunny = new BunnyCdnStream({ apiKey: 'apiKey', videoLibrary: 'vidLib' });
When you run the file, the following error occurs:
I tried to investigate this problem. I think the problem is due to the version of Axios specified in the NPM library (which is 0.27.2).
If you create a new empty NPM project and install [email protected] and do:
import { AxiosError } from 'axios'
the same exact error will appear. I then tried using [email protected] and it did not show any error.
The package.json file in this GitHub repo specifies version 1.2.6 while the one on NPM specifies 0.27.2
I hope my input was helpful. I'm happy to provide more info if needed.
Hey there,
first off all BIG thanks for this project. I made a video streaming backend and created the requests manually, but switched now to your client as it makes my life much easier.
However, I'm having a problem:
I'm using NextJS (13.1.6) API routes and get the following error:
My code looks like this:
export default withUserGuard(async function handler(req, res) {
if (req.method !== 'GET') {
res.setHeader("Allow", ["GET"]);
return res.status(405).json({ error: `Method ${req.method} Not Allowed` });
}
try {
const mostRecent = await getMostRecentVideos();
return res.status(200).json({ mostRecent });
} catch (e) {
return res.status(500).end();
}
});
const getMostRecentVideos = async () => {
const videos = await stream.listVideos({
page: 1,
itemsPerPage: 10,
orderBy: 'date'
})
return videos.items.map((video) => ({
viewTime: prettyPrintSeconds(video.length),
collection: collectionIdToGenre.get(video.collectionId),
...video,
}));
};
Do you have an idea how to solve that or is there a way to allow CommonJS modules properly?
Thanks and all the best!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.