0.0.22 • Published 1 year ago

fetch-yadb-server v0.0.22

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

fetch-yadb-server

A script to download Scrcpy server binary.

Usage

fetch-yadb-server <version>

For example:

fetch-yadb-server 2.1

The server binary is written to server.bin and the version is written to version.js in this package's root.

Autorun

Add to postinstall script in package.json:

{
    "scripts": {
        "postinstall": "fetch-yadb-server 2.1"
    }
}

Use in code

Webpack/Vite

It works out of the box for Webpack 5 and Vite.

BIN is a URL you can use in fetch to download.

import { BIN, VERSION } from "fetch-yadb-server";

console.log(VERSION); // 2.1
fetch(BIN)
    .then((res) => res.arrayBuffer())
    .then(console.log); // <ArrayBuffer ...>

Node.js

This package is in ES Module format, so it needs to be imported in another ES Module, or using createRequire.

BIN is a URL to a local file, you can use fs.readFile to read it.

import { BIN, VERSION } from "fetch-yadb-server";
import fs from "fs/promises";

console.log(VERSION); // 2.1
fs.readFile(BIN).then(console.log); // <Buffer ...>
0.0.22

1 year ago

0.0.21

1 year ago