microsoft/skills

azure-storage-blob-ts

浏览器上传 File,Node.js 负责文件流与受限授权

  • SKILL.md 已保存
  • 中文用法已整理
  • 安装与运行未实测
先判断是否解决你的问题

azure-storage-blob-ts 是什么?

azure-storage-blob-ts 介绍@azure/storage-blob的Block、Append与Page Blob,并区分Node.js文件/流接口和浏览器File上传。它适合Web文件服务,尤其要分清服务端凭证与浏览器使用的受限SAS。

中文说明由本站依据来源整理;英文原文保留在页面下方。

按客户端选择安装入口

怎么接入你的 Agent?

  1. 定位完整 Skill 目录

    打开本项目来源,核对 SKILL.md 及其引用的脚本和资料。

  2. 交给你正在用的 Agent

    在下面选择客户端,展开并复制安装指令,让 Agent 读取来源后选择安装方式。

  3. 确认识别,再做具体任务

    让 Agent 回报安装目录和识别到的名称 azure-storage-blob-ts,然后按本页使用示例提供材料。

展开并复制给 Codex 的安装指令
发送给 Codex

安装并检查 azure-storage-blob-ts

请在 Codex 的当前工作环境中安装并检查 azure-storage-blob-ts 这个 Skill。

项目身份:microsoft/skills / azure-storage-blob-ts
来源:https://github.com/microsoft/skills/blob/f03ec5392f7a0f3aca12af47477e92f1edf7b44c/.github/plugins/azure-sdk-typescript/skills/azure-storage-blob-ts/SKILL.md
已定位的源文件:.github/plugins/azure-sdk-typescript/skills/azure-storage-blob-ts/SKILL.md

1. 先阅读真实 SKILL.md 和它引用的必要文件,确认触发条件、安装方式、依赖与权限;尊重源文件要求的审批步骤。
2. 按当前客户端支持的方式安装完整 Skill 目录,保留已有配置,不只复制一段提示词。涉及缺失凭证、目标目录或权限时先列出缺项并向我确认。
3. 安装后回读实际目录、Skill 名称和识别结果,说明哪些步骤已完成,哪些只是文档检查,不得把安装成功当作任务已经实测。
4. 如来源提供了可安全验证的示例,在我提供所需输入后做一个最小任务;创建、修改、删除、部署或发送内容前,按源文件和我的授权执行。
准备输入,再按步骤执行

装好以后,具体怎么用?

准备哪些材料

  • 安装@azure/storage-blob与所需身份依赖,确认执行环境、账户/容器与对象名;浏览器方案还需匹配CORS和受限访问方式,不能把账户key放进前端。

会得到什么

  • 环境匹配的TypeScript文件上传/下载代码,以及服务端签发、浏览器使用的授权分工。

实际使用顺序

  1. 普通文件选BlockBlobClient;Node.js可uploadFile/uploadStream,浏览器用uploadData(File/Blob)。Append和Page Blob有不同写入语义,Page写入需符合对齐条件。
  2. 上传长度使用实际字节长度;下载Node可downloadToFile或处理readableStreamBody,浏览器按其响应体类型接入。源文标注两端通用的streamToText实际用了NodeJS.ReadableStream/Buffer,不能原样当浏览器代码。
  3. 服务端按Blob或容器范围签短期SAS,权限只覆盖任务,不照搬全权限账户SAS;列表按prefix/层级处理,复制用beginCopyFromURL并pollUntilDone,错误按403/404/409等区分。
使用示例

从一个具体任务开始

本站根据源文件编写的使用示例,未在本站实际运行。示例中的文件由你提供。

安装并识别 Skill 后发送

复制一个具体任务

教学任务:使用 azure-storage-blob-ts,为网页PDF上传设计前后端接口。浏览器使用File与uploadData,后端只为指定对象签短期上传所需SAS;不要把账户key、DefaultAzureCredential或Node的uploadFile塞进浏览器。只写方案,不签发或上传。
预期结果

预期得到平台接口分工明确的接入设计;本站未运行浏览器上传。

使用前先看这些限制

使用条件与边界

  • Node文件接口和SharedKey凭证不适用于浏览器。源快照的Node最低版本需与实际包要求重新核对。
  • SAS存在不表示CORS已经配置或文件上传已完成;SAS只是授权凭据,实际请求仍可能被网络/范围限制。
针对这个 Skill 的疑问

常见问题

为什么浏览器不能直接用uploadFile(path)?

它是Node.js本地文件接口。浏览器从用户选择得到File,再使用uploadData;文件系统路径、Node凭证与浏览器授权方式都不同。

需要核对时再展开原文

来源原文与资料状态

源文件
已保存 SKILL.md,抓取于 2026-11-16T12:36:35.145Z
中文使用说明
已针对下方源文件版本整理用途、用法和常见问题
安装与任务测试
本站未执行安装或任务测试
来源复核
本页中文用法已对照保存版本的完整 SKILL.md 阅读整理
展开 SKILL.md 原文、章节与历史收录资料

.github/plugins/azure-sdk-typescript/skills/azure-storage-blob-ts/SKILL.md · 抓取时间 2026-11-16T12:36:35.145Z

以下保留源文件的 description、章节及摘录,供核对中文说明;完整文件通过上方链接打开。

抓取成功不代表已完成安装或任务测试。

来源 description(原文)

Azure Blob Storage JavaScript/TypeScript SDK (@azure/storage-blob) for blob operations. Use for uploading, downloading, listing, and managing blobs and containers. Supports block blobs, append blobs, page blobs, SAS tokens, and streaming. Triggers: "blob storage", "@azure/storage-blob", "BlobServiceClient", "ContainerClient", "upload blob", "download blob", "SAS token", "block blob".

查看源文件章节 / Source sections
  • 原文:@azure/storage-blob (TypeScript/JavaScript)
  • 安装 / Installation
  • 原文:Environment Variables
  • 原文:Authentication
  • 原文:Microsoft Entra Token Credential (Recommended)
  • 原文:Connection String
  • 原文:StorageSharedKeyCredential (Node.js only)
  • 原文:SAS Token
  • 原文:Client Hierarchy
  • 原文:Container Operations
  • 原文:Create Container
  • 原文:List Containers
  • 原文:Delete Container
  • 原文:Blob Operations
  • 原文:Upload Blob (Simple)
  • 原文:Upload from File (Node.js only)
  • 原文:Upload from Stream (Node.js only)
  • 原文:Upload from Browser
  • 原文:Download Blob
  • 原文:Download to File (Node.js only)
  • 原文:Download to Buffer (Node.js only)
  • 原文:List Blobs
  • 原文:Delete Blob
  • 原文:Copy Blob
  • 原文:Blob Properties & Metadata
  • 原文:Get Properties
  • 原文:Set Metadata
  • 原文:Set HTTP Headers
  • 原文:SAS Token Generation (Node.js only)
  • 原文:Generate Blob SAS
原文:@azure/storage-blob (TypeScript/JavaScript)

SDK for Azure Blob Storage operations — upload, download, list, and manage blobs and containers.

安装 / Installation

```bash npm install @azure/storage-blob @azure/identity ``` **Current Version**: 12.x **Node.js**: >= 18.0.0

原文:Environment Variables

```bash AZURE_STORAGE_ACCOUNT_NAME=<account-name> AZURE_STORAGE_ACCOUNT_KEY=<account-key> # OR connection string AZURE_STORAGE_CONNECTION_STRING=DefaultEndpointsProtocol=https;AccountName=... AZURE_TOKEN_CREDENTIALS=prod # Required only if DefaultAzureCredential is used in production ```

原文:Microsoft Entra Token Credential (Recommended)

```typescript import { BlobServiceClient } from "@azure/storage-blob"; import { DefaultAzureCredential, ManagedIdentityCredential } from "@azure/identity"; // Local dev: DefaultAzureCredential. Production: set AZURE_TOKEN_CREDENTIALS=prod or AZURE_TOKEN_CREDENTIALS=<specific_credential> const credential = new DefaultAzureCredential({requiredEnvVars: ["AZURE_TOKEN_CREDENTIALS"]}); // Or use a specific credential directly in production: // See https://learn.microsoft.com/javascript/api/overview/azure/identity-readme?view=azure-node-latest#credential-classes // const credential = new ManagedIdentityCredential(); const accountName = process.env.AZURE_STORAGE_ACCOUNT_NAME!; const client = new BlobServiceClient( `https://${accountName}.blob.core.windows.net`, credential ); ```

原文:Connection String

```typescript import { BlobServiceClient } from "@azure/storage-blob"; const client = BlobServiceClient.fromConnectionString( process.env.AZURE_STORAGE_CONNECTION_STRING! ); ```

原文:StorageSharedKeyCredential (Node.js only)

```typescript import { BlobServiceClient, StorageSharedKeyCredential } from "@azure/storage-blob"; const accountName = process.env.AZURE_STORAGE_ACCOUNT_NAME!; const accountKey = process.env.AZURE_STORAGE_ACCOUNT_KEY!; const sharedKeyCredential = new StorageSharedKeyCredential(accountName, accountKey); const client = new BlobServiceClient( `https://${accountName}.blob.core.windows.net`, sharedKeyCredential ); ```

文件 SHA256:180a75a03963329bd2671651ab1b90ab7e21c1307e7f822a3f649d5bebf367d1

仓库许可证记录:MIT;skill-declaration-captured-not-interpreted,查看来源。

SKILL.md原文description · 2026-11-16T12:36:35.145Z

Azure Blob Storage JavaScript/TypeScript SDK (@azure/storage-blob) for blob operations. Use for uploading, downloading, listing, and managing blobs and containers. Supports block blobs, append blobs, page blobs, SAS tokens, and streaming. Triggers: "blob storage", "@azure/storage-blob", "BlobServiceClient", "ContainerClient", "upload blob", "download blob", "SAS token", "block blob".

查看历史简介来源

历史收录数据

来源仓库microsoft/skills
Skill源路径.github/plugins/azure-sdk-typescript/skills/azure-storage-blob-ts/SKILL.md

安装前请让使用的Agent先读取这个SKILL.md及其所在目录,确认依赖和所需权限。此页不生成未经来源验证的安装命令。

返回 Skills 目录,按任务继续筛选 · MCP与Skills教程与资源