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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@autoaction/vbn-node-client

v1.0.0

Published

VBN para NodeJs. Load Balance + CDN + bucket privado + url's assinadas (GCP)

Readme

Permissão de usuário necessária

É necessário que o usuário que vai acessar o GCP tenha essa permissão, caso contrário o cache não poderá ser invalidado

compute.urlMaps.invalidateCache

Certifique-se que o bucket está mapeado em um Load Balancer no GCP

Consulte o Notion específico para realizar as etapas abaixo: :: Acesse o Load Balancer :: Cria um backend de Bucket :: Crie o mapeamento do backent e o bucket

Em caso de atualização da lib

:: Fazer o push dentro da branch master :: criar uma tag vxxxxx (Ex: v1.0.8)

git tag v1.0.8

:: Fazer o push da tag

git push origin v1.0.8

Documento do Client para VBN

Inspirado em DSL(Domain Specific Language) internas, para controle e solicitação fluída

Abaixo um exemplo prático de um helper para implantar o projeto

Fase de configuração

const { VBNAutoAction, VBNUtils } = require('vbn-node-client');

class VBNHelper extends VBNAutoAction {
  static VBN_PROD_URL = 'https://url_da_cdn';
  static GOOGLE_LOAD_BALANCE = 'nome_do_load_balance';
  static DEFAULT_BUCKET = '';
  static GOOGLE_URL_MAP_NAME = 'nome_da_url_map';
  static CDN_TO_BUCKET = {
    'url_do_cdn_1': [
      'bucket_mapeado_1',
      'bucket_mapeado_2'
    ],
    'url_do_cdn_2': 'bucket_mapeado_1',
  };

  static initConfig() {
    return {
      cdn_key_name: 'nome_da_key_criado_no_load_balance',
      cdn_key_value: 'valor_da_key_criado_no_load_balance',
      google_key_file_path: 'arquivo_com_as_credenciais_do_gcp',
      google_bucket_mapped: {
        'url_do_cdn_1': [
          'bucket_mapeado_1',
          'bucket_mapeado_2'
        ],
        'url_do_cdn_2': [
          'bucket_mapeado_1'
        ]
      },
      cdn_hostname: new URL(this.VBN_PROD_URL).host,
      google_key_json: 'arquivo_com_as_credenciais_do_gcp_em_formato_json',
    };
  }

  static async getOneSingleImage(bucketName, prefix) {
    this.init(this.initConfig());
    const imagePath = `/${bucketName}/${prefix}`;
    const single = this.getOneFile(imagePath);
    return single;
  }

  static async getImagesByPrefix(bucketName, prefix) {
    this.init(this.initConfig());
    await VBNUtils.getGcpCredentials();
    VBNUtils.setBucket(bucketName);
    if (!this._credentials) {
      return [];
    }
    const [files] = await this._storage.bucket(bucketName).getFiles({ prefix });
    const images = files.map(obj => `${bucketName}/${obj.name}`);
    return this.getMultiplesImageSignature(images);
  }

  static async getMultiplesImage(images) {
    this.init(this.initConfig());
    return this.getMultiplesImageSignature(images);
  }

  static async invalidateVBNCache(imagePaths) {
    this.init(this.initConfig());
    return this.invalidateCache(imagePaths);
  }

  static async getSingleFileMetadata(imagePath, bucketName) {
    this.init(this.initConfig());
    await VBNUtils.getGcpCredentials();
    VBNUtils.setBucket(bucketName);
    const cleanPath = VBNUtils.removeBucketFromUrl(imagePath, bucketName);
    return this.getFileMetadata(cleanPath);
  }

  static async getMultiplesFileMetadata(imagePaths, bucketName) {
    this.init(this.initConfig());
    await VBNUtils.getGcpCredentials();
    VBNUtils.setBucket(bucketName);
    let data = [];
    for (const path of imagePaths) {
      const cleanPath = VBNUtils.removeBucketFromUrl(path, bucketName);
      const result = await this.getFileMetadata(cleanPath);
      data = data.concat(result);
    }
    return data;
  }

  static async getFileMetadataByPrefix(imagePath, bucketName) {
    this.init(this.initConfig());
    await VBNUtils.getGcpCredentials();
    VBNUtils.setBucket(bucketName);
    return this.getFileMetadata(imagePath, 'prefix');
  }

  async uploadFileByPath(file, bucketName) {
    this.init(this.initConfig());
    await VBNUtils.getGcpCredentials();
    VBNUtils.setBucket(bucketName);
    delete file.base64;
    return this.uploadFileInBucket(file);
  }

  async uploadFileByBase64(file, bucketName) {
    this.init(this.initConfig());
    await VBNUtils.getGcpCredentials();
    VBNUtils.setBucket(bucketName);
    delete file.localPath;
    return this.uploadFileInBucket(file);
  }

  async deleteSingleFile(filePath, bucketName) {
    this.init(this.initConfig());
    await VBNUtils.getGcpCredentials();
    VBNUtils.setBucket(bucketName);
    return this.deleteFileInBucket(filePath, 'single');
  }

  async deleteFileByPrefix(filePrefix, bucketName) {
    this.init(this.initConfig());
    await VBNUtils.getGcpCredentials();
    VBNUtils.setBucket(bucketName);
    return this.deleteFileInBucket(filePrefix, 'prefix');
  }

  async addSingleFileMetadata(filePath, bucketName) {
    this.init(this.initConfig());
    await VBNUtils.getGcpCredentials();
    VBNUtils.setBucket(bucketName);
    const single = {
      fileName: filePath,
      path: `${bucketName}/${filePath}`,
    };
    const metadata = {
      [`${bucketName}/${filePath}`]: {
        metadata1: 'metadados1',
        segundometadados: 'outrometadados',
      }
    };
    return this.addMetadataToSingle(single, metadata);
  }
}

module.exports = VBNHelper;