From afaf008ba2fe0059a64bbb4bb37759210dae0c9d Mon Sep 17 00:00:00 2001 From: ashutoshkhainar33-star Date: Fri, 4 Sep 2026 12:47:08 +0530 Subject: [PATCH 1/2] Revise README for FastPix Astro Uploader Updated README.md to enhance documentation and clarify usage instructions. --- README.md | 146 +++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 106 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index 299a133..2c97ff1 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,19 @@ -# Introduction +# FastPix Astro Uploader - resumable, chunked file uploads for Astro (``) + +[![npm version](https://img.shields.io/npm/v/@fastpix/fp-astro-uploader)](https://www.npmjs.com/package/@fastpix/fp-astro-uploader) +[![npm downloads](https://img.shields.io/npm/dm/@fastpix/fp-astro-uploader)](https://www.npmjs.com/package/@fastpix/fp-astro-uploader) +[![license](https://img.shields.io/npm/l/@fastpix/fp-astro-uploader)](https://github.com/FastPix/astro-web-uploader/blob/main/LICENSE) +[![Astro](https://img.shields.io/badge/Astro-BC52EE?logo=astro&logoColor=white)](https://astro.build) +[![TypeScript](https://img.shields.io/badge/TypeScript-3178C6?logo=typescript&logoColor=white)](https://www.typescriptlang.org/) A FastPix Astro component for resumable uploads, built on the [FastPix resumable web uploads SDK](https://github.com/FastPix/web-uploads-sdk). `` provides a complete upload experience, including file selection, drag-and-drop, upload progress, and pause, resume, and cancel controls. You can also compose it from individual components to customize the layout. Provide an upload URL, and the component uploads the file in resumable chunks, reports progress, and fires a `success` event when the upload completes. +**Works with:** Astro 7+ · TypeScript · any UI framework (or none) · drag-and-drop · resumable chunked uploads + +📖 **Docs:** https://fastpix.com/docs/video-on-demand-api/input-video/direct-upload-video-media  ·  📦 **npm:** https://www.npmjs.com/package/@fastpix/fp-astro-uploader  ·  🚀 **Dashboard:** https://dashboard.fastpix.com + ## Key Features - **Resumable** - pause, resume, and cancel an in-progress upload. @@ -15,47 +25,37 @@ A FastPix Astro component for resumable uploads, built on the [FastPix resumable - **Typed** - ships with TypeScript definitions and a typed `fastpix-*` DOM event map. - **Accessible** - status changes are announced to assistive technology, supports keyboard navigation. -## Prerequisites +## Start here -### Getting Started with FastPix +If you are adding the FastPix Astro Uploader for the first time, follow these steps in order: -To use this component, you need a signed upload URL. +1. [Install the component](#install-the-component) +2. [Get a signed upload URL](#get-a-signed-upload-url) +3. [Add the uploader to a page](#add-the-uploader) +4. [Provide the upload URL](#provide-the-upload-url) +5. [Handle the upload result](#handle-the-upload-result) +6. [Understand the upload workflow](#understand-the-upload-workflow) -To make API requests, you'll need a valid **Access Token** and **Secret Key**. See the [Basic Authentication Guide](https://fastpix.com/docs/getting-started/activate-your-account) for details on retrieving these credentials. +Do not skip the verification step. If an install, credential, or upload-URL problem occurs, fix it before continuing. -After you have your credentials, use the [Upload media from device](https://fastpix.com/docs/video-on-demand-api/input-video/direct-upload-video-media) API to generate a signed URL. You pass that URL to the component, and it uploads the file in resumable chunks. Creating the upload URL, checking when the media is ready for playback, and rendering the player are handled in your own application. +--- -```text -your app ──── upload URL ────▶ ──── fastpix-success ────▶ your app -``` +### Before you begin + +To use the component, make sure you have: + +- An Astro project (Astro 7+; see the peer-dependency note in [Install the component](#install-the-component)). +- Node.js and a package manager (npm, pnpm, or yarn). +- A FastPix account, with an Access Token and a Secret Key. +- A backend or serverless function that can create a signed upload URL - your credentials must never ship in browser code. + +FastPix uploads use a **signed URL**: you create a short-lived upload URL on your server with the [Upload media from device](https://fastpix.com/docs/video-on-demand-api/input-video/direct-upload-video-media) API, then hand only that URL to the component. -## Table of Contents - -- [Installation](#installation) -- [Basic Usage](#basic-usage) - - [Import](#import) - - [Integration](#integration) - - [Providing the upload URL](#providing-the-upload-url) - - [Example project](#example-project) -- [Lifecycle Events](#lifecycle-events) -- [Composition](#composition) -- [Concepts](#concepts) -- [Parameters Accepted](#parameters-accepted) - - [Events](#events) - - [Imperative control](#imperative-control) -- [Components](#components) -- [Headless / `/core`](#headless-core) -- [Appearance](#appearance) -- [Types](#types) -- [File access on mobile](#file-access-on-mobile) -- [Framework and browser support](#framework-and-browser-support) -- [Accessibility](#accessibility) -- [Stability](#stability) -- [References](#references) -- [Detailed Usage](#detailed-usage) -- [License](#license) - -## Installation +> **Security:** Never expose your Access Token or Secret Key in browser code. Create signed URLs on your server and return only the URL to the client. + +--- + +## Install the component Install the component using your preferred package manager.: @@ -81,7 +81,16 @@ yarn add @fastpix/fp-astro-uploader@latest No stylesheet import is needed - styling ships with the component automatically (see [Appearance](#appearance)). -## Basic Usage +## Get a signed upload URL + +To use this component, you need a signed upload URL. + +To make API requests, you'll need a valid **Access Token** and **Secret Key**. See the [Basic Authentication Guide](https://fastpix.com/docs/getting-started/activate-your-account) for details on retrieving these credentials. + +After you have your credentials, use the [Upload media from device](https://fastpix.com/docs/video-on-demand-api/input-video/direct-upload-video-media) API to generate a signed URL. You pass that URL to the component, and it uploads the file in resumable chunks. Creating the upload URL, checking when the media is ready for playback, and rendering the player are handled in your own application. + + +## Add the uploader ### Import @@ -103,7 +112,7 @@ import { FastPixUploader } from "@fastpix/fp-astro-uploader"; ``` -### Providing the upload URL +## Provide the upload URL A static string works for the zero-config case above. In practice you'll create the upload URL once a file is selected - Astro's server→client boundary means a _function_ prop can't cross from frontmatter, so assign it from a client `