ya-webadb/libraries/fetch-scrcpy-server
dependabot[bot] 4d6af115b0 chore(deps): bump vite in /libraries/fetch-scrcpy-server/examples/vite
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 4.4.11 to 4.4.12.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v4.4.12/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v4.4.12/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-07 14:19:05 +08:00
..
bin feat(scrcpy): support v2.2 2023-11-03 11:18:25 +08:00
examples chore(deps): bump vite in /libraries/fetch-scrcpy-server/examples/vite 2023-12-07 14:19:05 +08:00
.gitignore feat(scrcpy-server): separate package, add support for Vite 2023-06-27 15:29:35 +08:00
CHANGELOG.json chore: bump versions 2023-08-25 22:07:52 +08:00
CHANGELOG.md chore: bump versions 2023-08-25 22:07:52 +08:00
LICENSE feat(scrcpy-server): separate package, add support for Vite 2023-06-27 15:29:35 +08:00
package.json chore: update dependencies 2023-12-04 17:10:43 +08:00
README.md chore: update dependencies 2023-09-21 11:26:09 +08:00
scrcpy.LICENSE feat(scrcpy-server): separate package, add support for Vite 2023-06-27 15:29:35 +08:00

@yume-chan/fetch-scrcpy-server

A script to download Scrcpy server binary from official GitHub releases.

Usage

fetch-scrcpy-server <version>

For example:

fetch-scrcpy-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 your package.json:

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

Consume server.bin

Webpack/Vite

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

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

import { BIN, VERSION } from "@yume-chan/fetch-scrcpy-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 "@yume-chan/fetch-scrcpy-server";
import fs from "fs/promises";

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