How to use the urlencode.encode function in urlencode

To help you get started, we’ve selected a few urlencode examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sofastack / sofa-rpc-node / lib / registry / zk / data_client.js View on Github external
async register(config) {
    assert(config && config.interfaceName, '[ZookeeperRegistry] register(config) config.interfaceName is required');
    assert(config.url, '[ZookeeperRegistry] register(config) config.url is required');
    const providerPath = this._buildProviderPath(config);
    await this._zkClient.mkdirp(providerPath);
    const path = providerPath + '/' + urlencode.encode(config.url);
    this._registerMap.set(path, config);
    try {
      // NOTE: Maybe the path is invalid, so remove it first
      if (await this._zkClient.exists(path)) {
        await this._remove(path);
      }
      await this._zkClient.create(path, EMPTY, this.options.ephemeralNode ? CreateMode.EPHEMERAL : CreateMode.PERSISTENT);
    } catch (err) {
      if (err.name === 'NODE_EXISTS' && err.code === -110) {
        return;
      }
      throw err;
    }
  }
github TheBrainFamily / TheBrain2.0 / server / src / api / mongooseSetup.js View on Github external
const generateResetPasswordToken = async (userId) => {
  const rawToken = `${userId}_W3GojrLkVLKH9l`
  // we are using hashing function as a clean way to generate a random string
  const salt = await bcrypt.genSalt(Math.random())
  return urlencode.encode(await bcrypt.hash(rawToken, salt))
}
github TheBrainFamily / TheBrain2.0 / server / src / api / repositories / UsersRepository.js View on Github external
const generateResetPasswordToken = async (userId) => {
  const rawToken = `${userId}_W3GojrLkVLKH9l`
  // we are using hashing function as a clean way to generate a random string
  const salt = await bcrypt.genSalt(SALT_WORK_FACTOR)
  return urlencode.encode(await bcrypt.hash(rawToken, salt))
}
github sofastack / sofa-rpc-node / lib / registry / zk / data_client.js View on Github external
const originAddressList = children.map(url => urlencode.decode(url));
            const addressList = originAddressList.filter(url => this._isMatch(config, url));
            this.logger.info('[ZookeeperRegistry] receive interface:%s:%s@%s address list (%d):\n%s\nvalid providers (%d):\n%s',
              config.interfaceName, config.version || '', config.group || '',
              originAddressList.length, formatAddrs(originAddressList), addressList.length, formatAddrs(addressList));
            this._subscribeMap.set(interfaceName, addressList);
            this.emit(interfaceName, addressList);
          });
        })
        .catch(err => { this.emit('error', err); });

      const consumerPath = this._buildConsumerPath(config);
      const consumerUrl = fmt('%s://%s?uniqueId=%s&version=%s&pid=%s&timeout=%s&appName=%s&serialization=%s&startTime=',
        config.protocol || 'bolt', localIp, config.uniqueId || '', '1.0', process.pid, config.timeout, config.appName || '', Date.now());

      const path = consumerPath + '/' + urlencode.encode(consumerUrl);
      this._zkClient.mkdirp(consumerPath)
        .then(() => {
          return this._zkClient.create(path, EMPTY, CreateMode.EPHEMERAL);
        })
        .catch(err => {
          this.logger.warn('[ZookeeperRegistry] create consumerPath: %s failed, caused by %s', path, err.message);
        });
    } else {
      const addressList = this._subscribeMap.get(interfaceName);
      if (addressList) {
        setImmediate(() => { listener(addressList); });
      }
    }
    this.on(interfaceName, listener);
  }
github sofastack / sofa-rpc-node / lib / registry / zk / data_client.js View on Github external
async unRegister(config) {
    assert(config && config.interfaceName, '[ZookeeperRegistry] unRegister(config) config.interfaceName is required');
    assert(config.url, '[ZookeeperRegistry] unRegister(config) config.url is required');
    const providerPath = this._buildProviderPath(config);
    const path = providerPath + '/' + urlencode.encode(config.url);
    this._registerMap.delete(path);
    await this._remove(path);
  }
github Andro999b / torrent-player / server / service / trackers / providers / DataLIfeProvider.js View on Github external
return () => {
            const request = requestFactory({ proxy: useProxy })
                .post(searchUrl)
                .type('form')
                .field({ 
                    do: 'search',
                    subaction: 'search',
                    search_start: 0,
                    full_search: 0,
                    result_from: 1,
                    story: encoding ? urlencode.encode(query, encoding) : query
                })
                .buffer(true)
                .charset()
                .timeout(timeout)
                .set(headers)

            return request
        }
    }

urlencode

encodeURIComponent with charset

MIT
Latest version published 1 year ago

Package Health Score

57 / 100
Full package analysis