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

@gasboost/fake-node

v0.1.2

Published

This package provides a fake implementation of Google Apps Script built-in services for testing purposes.

Readme

@gasboost/fake-node

Node.js 上で Google Apps Script の Utilities を利用するための fake implementation を提供します。

@gasboost/fake-core の共通実装と Node.js の標準 API を組み合わせて、GAS の Utilities に対応する処理を実装します。

インストール

pnpm add -D @gasboost/fake-node

npm:

npm install -D @gasboost/fake-node

TypeScript で GAS の型を利用する場合は、必要に応じて型定義も追加してください。

pnpm add -D @types/google-apps-script

Quick Start

import { NodeUtilities } from "@gasboost/fake-node";

const Utilities = new NodeUtilities();

const id = Utilities.getUuid();

const encoded = Utilities.base64Encode("hello");

const digest = Utilities.computeDigest(
  Utilities.DigestAlgorithm.SHA_256,
  "hello",
);

NodeUtilitiesGoogleAppsScript.Utilities.Utilities を実装しています。

Public API

現在 package entry point から以下を公開しています。

  • NodeUtilities
  • Charset
  • DigestAlgorithms
  • MacAlgorithms
  • RsaAlgorithm

実装済み Utilities

現在の NodeUtilities では主に以下を実装しています。

UUID

Utilities.getUuid();

Node.js の crypto.randomUUID() を利用可能な場合はそれを使用します。

Base64

Utilities.base64Encode(data);
Utilities.base64EncodeWebSafe(data);

Utilities.base64Decode(encoded);
Utilities.base64DecodeWebSafe(encoded);

Date

Utilities.formatDate(date, timeZone, format);
Utilities.parseDate(value, timeZone, format);

String

Utilities.formatString(template, ...args);

Digest

Utilities.computeDigest(Utilities.DigestAlgorithm.SHA_256, value);

現在以下の Digest Algorithm 定数を公開しています。

  • MD2
  • MD5
  • SHA_1
  • SHA_256
  • SHA_384
  • SHA_512

MD2 は @gasboost/fake-core の実装を利用し、それ以外は Node.js の crypto を利用します。

HMAC

Utilities.computeHmacSignature(Utilities.MacAlgorithm.HMAC_SHA_256, value, key);

Utilities.computeHmacSha256Signature(value, key);

現在以下の Mac Algorithm 定数を公開しています。

  • HMAC_MD5
  • HMAC_SHA_1
  • HMAC_SHA_256
  • HMAC_SHA_384
  • HMAC_SHA_512

RSA Signature

Utilities.computeRsaSignature(
  Utilities.RsaAlgorithm.RSA_SHA_256,
  value,
  privateKey,
);

Utilities.computeRsaSha1Signature(value, privateKey);

Utilities.computeRsaSha256Signature(value, privateKey);

Blob

const blob = Utilities.newBlob("hello", "text/plain", "hello.txt");

Blob の実体には @gasboost/fake-coreInMemoryBlob を利用します。

gzip / zip

const gzipped = Utilities.gzip(blob);
const restored = Utilities.ungzip(gzipped);

const archive = Utilities.zip([blob]);
const files = Utilities.unzip(archive);

gzip / ungzip は Node.js の zlib、zip / unzip は fflate を利用します。

CSV

Utilities.parseCsv(csv);
Utilities.parseCsv(csv, ";");

quoted field、escaped quote、改行を含む CSV を解析します。

sleep

Utilities.sleep(1000);

GAS の同期 API に合わせ、指定時間ブロックする実装です。

JSON

Utilities.jsonParse(json);
Utilities.jsonStringify(value);

Node.js 依存

@gasboost/fake-node は以下の Node.js API / package を利用します。

  • node:crypto
  • node:util
  • node:zlib
  • date-fns-tz
  • fflate

そのため、この package は Node.js 環境向けです。

Node.js 固有 API に依存しない fake implementation は @gasboost/fake-core に分離されています。

責務

@gasboost/fake-node が担当するもの:

  • Node.js 上での GAS Utilities implementation
  • crypto / digest / HMAC / RSA
  • Base64
  • date format / parse
  • Blob generation
  • gzip / zip
  • CSV parse
  • sleep
  • JSON parse / stringify

Cache、Properties、Session などの in-memory implementation は @gasboost/fake-core が担当します。

制約

Google Apps Script の Utilities 全 API の完全な emulator ではありません。

現在 NodeUtilities に実装されている method のみをサポート対象とします。

関連パッケージ

  • @gasboost/fake-core — 共通 in-memory implementation と Utilities 補助実装

License

MIT