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

nv-remote-translate

v1.0.1

Published

nv-remote-translate ============ - cli tool - create a translate json file server - support dynamic-modify-config through unix\_sock OR http

Downloads

1

Readme

nv-remote-translate

  • cli tool
  • create a translate json file server
  • support dynamic-modify-config through unix_sock OR http

install

  • npm install nv-remote-translate

usage

 #  npm install nv-remote-translate -g
 
    nv_rtrans_srv -H
    Usage: nv_rtrans_srv [options]
    Options:
        -p, --port           server port or unix_sock, default ./___usock___
        -d, --workdir        work dir, default ./
        -H, --help           usage

HTTP

init

  # mkdir trans-srv
  # cd trans-srv/
  # nv_rtrans_srv -p 18888
    
    //...wait install node_modules

    trans-srv# ls -l | egrep -v "node_modules|package"
    total 16
    -rw-r--r--  1 root root  297 Feb 15 03:25 srv.js
    -rw-r--r--  1 root root  225 Feb 15 03:25 translate.json
    trans-srv#



    trans-srv# cat srv.js

    const S = require("nv-remote-translate-srv");
    const path = require("path");
    module.exports = async ()=> {
        await S(18888,path.join("/mnt/sdb/JS/BUSINESS-LIB_/nv-remote-translate/TEST/trans-srv",'translate.json'),"/mnt/sdb/JS/BUSINESS-LIB_/nv-remote-translate/TEST/trans-srv");
        return(S)
    }
    trans-srv#

edit tbl

 # vim translate.json 
 /*
    {
        "cnl": [
            "c0",
            "c1",
            "c2"
        ],
        "tbl": [
            [
                "A",
                "B",
                "C"
            ],
            [
                "a",
                "b",
                "c"
            ]
        ]
    }

 */ 

start srv

    > const S = await require("./srv")()
    listen on: 18888
    
    > S.CFG         //this is a getter, for dynamic-change-from-remote
    >

get config from remote

      # nv_rtrans_cli -S -p 18888

        _T {
          '#cnl': [ 'c0', 'c1', 'c2' ],
          '#tbl': [ [ 'A', 'B', 'C' ], [ 'a', 'b', 'c' ] ]
        }

change config from remote when server running

  • CFG is keywords

add

    nv_rtrans_client -m "CFG.add(['cA','cB','cC'])" -p 18888 

    before:
    _T {
      '#cnl': [ 'c0', 'c1', 'c2' ],
      '#tbl': [ [ 'A', 'B', 'C' ], [ 'a', 'b', 'c' ] ]
    }
    ------------
    after:
    _T {
      '#cnl': [ 'c0', 'c1', 'c2' ],
      '#tbl': [ [ 'A', 'B', 'C' ], [ 'a', 'b', 'c' ], [ 'cA', 'cB', 'cC' ] ]
    }

check it on server AFTER change from client

    > S.CFG
    _T {
      '#cnl': [ 'c0', 'c1', 'c2' ],
      '#tbl': [ [ 'A', 'B', 'C' ], [ 'a', 'b', 'c' ], [ 'cA', 'cB', 'cC' ] ]
    }
    >

check the cfg file AFTER change from client

    cat translate.json
    {
        "cnl": [
            "c0",
            "c1",
            "c2"
        ],
        "tbl": [
            [
                "A",
                "B",
                "C"
            ],
            [
                "a",
                "b",
                "c"
            ],
            [
                "cA",
                "cB",
                "cC"
            ]
        ]
    }

delete

    nv_rtrans_client -m "CFG.del('cA')" -p 18888

others

    //see readme of https://www.npmjs.com/package/nv-facutil-simple-translate


    nv_rtrans_client -m "console.log(Object.getOwnPropertyNames(CFG))" -p 18888
    before:
    _T {
      '#cnl': [ 'c0', 'c1', 'c2' ],
      '#tbl': [ [ 'A', 'B', 'C' ], [ 'a', 'b', 'c' ], [ 'cA', 'cB', 'cC' ] ]
    }
    ------------
    [
      '#cnl',         '#tbl',
      'col_c0',       'col_c1',
      'col_c2',       'dict_c0_to_c1',
      'map_c0_to_c1', 'dict_c1_to_c0',
      'map_c1_to_c0', 'dict_c0_to_c2',
      'map_c0_to_c2', 'dict_c2_to_c0',
      'map_c2_to_c0', 'dict_c1_to_c2',
      'map_c1_to_c2', 'dict_c2_to_c1',
      'map_c2_to_c1'
    ]
    after:
    _T {
      '#cnl': [ 'c0', 'c1', 'c2' ],
      '#tbl': [ [ 'A', 'B', 'C' ], [ 'a', 'b', 'c' ], [ 'cA', 'cB', 'cC' ] ]
    }


    # nv_rtrans_client -m "console.log(CFG.constructor.prototype)" -p 18888
    before:
    _T {
      '#cnl': [ 'c0', 'c1', 'c2' ],
      '#tbl': [ [ 'A', 'B', 'C' ], [ 'a', 'b', 'c' ], [ 'cA', 'cB', 'cC' ] ]
    }
    ------------
    {
      add: [Function (anonymous)],
      del: [Function (anonymous)],
      dump: [Function (anonymous)],
      get: [Function (anonymous)],
      get_all: [Function (anonymous)],
      slct: [Function (anonymous)]
    }
    after:
    _T {
      '#cnl': [ 'c0', 'c1', 'c2' ],
      '#tbl': [ [ 'A', 'B', 'C' ], [ 'a', 'b', 'c' ], [ 'cA', 'cB', 'cC' ] ]
    }


    # nv_rtrans_client -m "console.log(CFG.dict_c1_to_c0)" -p 18888
    before:
    _T {
      '#cnl': [ 'c0', 'c1', 'c2' ],
      '#tbl': [ [ 'A', 'B', 'C' ], [ 'a', 'b', 'c' ], [ 'cA', 'cB', 'cC' ] ]
    }
    ------------
    { B: 'A', b: 'a', cB: 'cA' }
    after:
    _T {
      '#cnl': [ 'c0', 'c1', 'c2' ],
      '#tbl': [ [ 'A', 'B', 'C' ], [ 'a', 'b', 'c' ], [ 'cA', 'cB', 'cC' ] ]
    }

    # nv_rtrans_client -m "console.log(CFG.dict_c0_to_c1)" -p 18888
    before:
    _T {
      '#cnl': [ 'c0', 'c1', 'c2' ],
      '#tbl': [ [ 'A', 'B', 'C' ], [ 'a', 'b', 'c' ], [ 'cA', 'cB', 'cC' ] ]
    }
    ------------
    { A: 'B', a: 'b', cA: 'cB' }
    after:
    _T {
      '#cnl': [ 'c0', 'c1', 'c2' ],
      '#tbl': [ [ 'A', 'B', 'C' ], [ 'a', 'b', 'c' ], [ 'cA', 'cB', 'cC' ] ]
    }

UNIX_SOCK

  • for security

server

 # vim ./srv
 //change the port to undefined
    const S = require("nv-remote-translate-srv");
    const path = require("path");
    module.exports = async ()=> {
        await S(
            undefined, //===>
            path.join("/mnt/sdb/JS/BUSINESS-LIB_/nv-remote-translate/TEST/trans-srv",'translate.json'),
            "/mnt/sdb/JS/BUSINESS-LIB_/nv-remote-translate/TEST/trans-srv"
        );
        return(S)
    }


 > const S = await require("./srv")()
     listen on: /mnt/sdb/JS/BUSINESS-LIB_/nv-remote-translate/TEST/trans-srv/___usock___

client

 //JUST without -p if in dir-of-translate.json , others same as http
 nv_rtrans_client -S -p /mnt/sdb/JS/BUSINESS-LIB_/nv-remote-translate/TEST/trans-srv/___usock___

 nv_rtrans_client -S
 nv_rcfg_client -m "..."

LICENSE

  • ISC