npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-iserver

v1.1.8

Published

iserver

Downloads

7

Readme

| | IServer | | - | ------------ | | ⚡️ | Powerful Kotlin android-side is build on scratch with kotlin | | 😎 | Unzip Feature. unzip files through this module | | 📱 | Multiplatform. iOS, Android | | ⏱ | Fast. About TO Migrating to RN New Arch(JSI) | | ⚠️ | Static typing Full-Support TypeScript |

Why MLKitTranslator?

Key capabilities

  • Both android and ios are supported. ios-side is powered by GCDWebserver and android-side is build on scratch by myself, stable and reliable
  • I'm also about to migrating this package to JSI or Turbomodule when it's ready to go

Installation

yarn add react-native-iserver

or

npm i --save react-native-iserver

Usage

ETC: you'd like to download a zip file and start local server to server these files

ETC: 比如你想下载一个压缩包、解压后并启动本地静态资源服务器来提供文件的访问

import RNFS from 'react-native-fs';
import IServer from 'react-native-iserver';

const serverPath = '';
const port = 8080;
async function execute() {
    let url = ''
    let path = ''
    let { jobId, promise: task } = RNFS.downloadFile({
        fromUrl: url,
        toFile: path,
    });
    try {
        let zipExists = await RNFS.exists(path)
        if (!zipExists) {
            await task
        }
        IServer.unzip({
            zip: path,
            dest: serverPath,
            onError: (e) => {
                //zip file is not valid
            }
        })
    } catch (error) {
    }
}
useEffect(() => {
    IServer.listen({
        onStart: () => {
            //starting to unzip file
        },
        onSuccess: () => {
            IServer.startWithPort({
                directoryPath: serverPath,
                port
            }).then(started => {
                console.log('the server start ' + (started ? 'success' :'failed'))
            })
        }
    })
}, [])

APIS

startWithPort

启动本地静态资源服务

(options: {
    directory: string;
    port: number;
    indexFileName?: string; // index.html
    cacheAge?: number; // 3600 on ios and 0 on android
}) => void;

isRunning

server是否正在运行

() => void;

stop

停止本地server

() => void;

unzip

解压本地ZIP压缩包,解压状态需通过listen方法进行监听

(options: {
    zip: string;
    dest: string;
    onError?: (e: string) => void;
}) => void;

listen

解压本地ZIP压缩包,解压状态需通过listen方法进行监听

(configs?: {
    onStart?: () => void;
    onSuccess?: () => void;
    onError?: (e) => void;
}) => void;

Author and license

ReactNativeIServer was created by @yaaliuzhipeng

react-native-iserver is available under the MIT license. See the LICENSE file for more info.