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

n8n-nodes-variable-storage

v2.3.1

Published

N8N节点:在工作流中设置和获取变量,支持多种数据类型

Readme

N8N Variable Storage Node

npm version License: MIT

一个强大的N8N自定义节点,用于在工作流执行期间设置和获取变量。支持多种数据类型,让你的工作流更加灵活。

✨ 功能特性

  • 🔧 批量设置变量:在一个节点中同时设置多个变量
  • 📖 获取变量:从工作流中读取已存储的值
  • 🎯 多种数据类型:支持String、Number、Boolean、Array、Object
  • 📝 手动添加模式:逐个添加变量,每个变量可设置不同类型
  • 🔒 作用域隔离:变量仅在同一工作流执行期间有效
  • 高性能:基于内存存储,快速读写
  • 🛡️ 错误处理:完善的错误提示和默认值支持
  • 🔄 数据流控制:可选择保留或替换输入数据

📦 安装

通过N8N社区节点安装(推荐)

  1. 打开N8N界面
  2. 进入 SettingsCommunity Nodes
  3. 点击 Install a community node
  4. 输入包名:n8n-nodes-variable-storage
  5. 点击安装并重启N8N

通过npm安装

# 全局安装
npm install -g n8n-nodes-variable-storage

# 或在N8N项目目录中安装
npm install n8n-nodes-variable-storage

🚀 使用方法

批量设置变量

  1. 添加 Variable Storage 节点到工作流
  2. 选择操作:Set Variables
  3. 点击 Add Value 添加变量:
    • Name: user_count
    • Type: Number
    • Value: 100
  4. 继续添加更多变量:
    • Name: user_name
    • Type: String
    • Value: John Doe
    • Name: user_tags
    • Type: Array
    • Value: ["admin", "premium"]

获取变量

  1. 在工作流的其他位置添加 Variable Storage 节点
  2. 选择操作:Get Variable
  3. 配置参数:
    • Variable Name: user_count
    • Default Value: 0 (可选)

📋 使用示例

示例1:批量设置用户信息

Start → Variable Storage(Set: user_id=123, user_name="John", user_type="premium") 
      → HTTP Request(使用变量)
      → End

示例2:配置管理

Start → Variable Storage(Set: api_url="https://api.example.com", timeout=30, retries=3)
      → HTTP Request(使用配置变量)
      → Variable Storage(Get: user_id)
      → End

示例3:数据处理流水线

Start → Variable Storage(Set: processed_count=0, errors=[], results={})
      → Loop Node
      → Variable Storage(Get: processed_count)
      → Process Data
      → Variable Storage(Set: processed_count=processed_count+1)
      → End

🔧 支持的数据类型

| 类型 | 描述 | 示例 | |------|------|------| | String | 文本字符串 | "Hello World" | | Number | 数字 | 42, 3.14 | | Boolean | 布尔值 | true, false | | Array | 数组 | [1, 2, 3], ["a", "b", "c"] | | Object | 对象 | {"name": "John", "age": 30} |

⚙️ 配置选项

Set Variables 操作

  • Keep Only Set (可选): 是否只保留设置的变量,移除其他输入数据
  • Values to Set: 要设置的变量列表
    • Name (必填): 变量名称
    • Type: 数据类型选择
    • Value (必填): 要设置的值
  • Options:
    • Include Binary Data: 是否在输出中包含二进制数据

Get Variable 操作

  • Variable Name (必填): 要获取的变量名称
  • Default Value (可选): 变量不存在时的默认值

🔍 错误处理

  • 变量名称为空时会抛出错误
  • 数字类型转换失败时会提示具体错误
  • JSON格式错误时会显示详细信息
  • 获取不存在的变量时可以设置默认值

🤝 贡献

欢迎提交Issue和Pull Request!

📄 许可证

MIT License - 详见 LICENSE 文件

🔗 相关链接

节点说明

CustomNode

  • 支持用户资源的获取和创建操作
  • 可配置API凭据
  • 包含错误处理和验证

开发建议

  1. nodes/目录下创建新的节点
  2. credentials/目录下创建对应的凭据
  3. 更新package.json中的n8n配置
  4. 添加适当的图标文件

文档