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

pict-section-upload

v1.0.0

Published

Pict-native themeable dropzone file-upload control — drag-and-drop, multi-file, per-file progress, read-in-browser or stream-to-server through a host-agnostic UploadTarget seam (with built-in Browser and Server targets).

Downloads

528

Readme

pict-section-upload

A themeable, pict-native dropzone file-upload control. Drag-and-drop or browse, single & multi file, per-file progress + status, and a host-agnostic UploadTarget seam: read files entirely in the browser (for client-side parsing) or stream/POST them up to a server.

Built to the Pict conventions: a provider exposes the API + registers themed CSS, a view renders the dropzone, and the destination of the bytes is a swappable target — mirroring the DataProvider seam in pict-section-picker.

Install

npm install pict-section-upload

Depends only on pict-provider + pict-view.

Usage

const libPictSectionUpload = require('pict-section-upload');

// Register the provider (once).
pict.addProvider('Pict-Section-Upload', libPictSectionUpload.default_configuration, libPictSectionUpload);
const tmpUpload = pict.providers['Pict-Section-Upload'];

// A read-in-browser uploader (the bytes never leave the page):
tmpUpload.createUploader('MyUploader',
{
    DestinationAddress: '#MyUploader',
    ValueAddress:       'AppData.MyForm.File',   // receives the file handle
    Accept:             '.csv,.tsv,text/csv',     // <input accept>-style filter
    MaxSize:            10 * 1024 * 1024,         // bytes (0 = unbounded)
    Multiple:           false,
    OnComplete: (pHandle) =>
    {
        pHandle.getText((pError, pText) => { /* parse pText client-side */ });
    },
});
pict.views['MyUploader'].render();

Stream to a server

tmpUpload.createUploader('ServerUploader',
{
    UploadTarget: { Type: 'server', Endpoint: '/1.0/Upload', Method: 'POST', FieldName: 'file' },
    OnProgress: (pHandle, pPercent) => { /* ... */ },
    OnComplete: (pHandle) => { /* pHandle.ServerId / pHandle.ServerURL */ },
});

Set Raw: true on the server target to stream the raw file body (e.g. a PUT to object storage) instead of multipart FormData. Supply ResponseHandle(xhr) to map a custom response into { ServerId, ServerURL, ServerResponse }.

The file handle (downstream contract)

ValueAddress (and getFiles()) yield handles shaped like:

{
    Hash, Name, Size, Type,
    Status: 'pending' | 'reading' | 'uploading' | 'complete' | 'error',
    Progress, Error, ServerId, ServerURL, ServerResponse,
    getText(cb), getArrayBuffer(cb), getDataURL(cb), getFile()
}

The read methods are non-enumerable, so a handle JSON.stringifys to just its data fields (safe to stash in AppData) while staying callable on the live object.

Custom targets

UploadTarget may be 'browser', 'server', a { Type:'server', ... } object, or any object implementing the seam:

{
    supportsUpload: boolean,
    read(pFile, 'text'|'arraybuffer'|'dataurl', fCallback),
    upload(pHandle, pFile, fProgress, fCallback) -> { abort() }
}

Provider API

| Method | Purpose | |---|---| | createUploader(hash, config) | Create (or reconfigure + reuse) an uploader view. | | createBrowserTarget(config) / createServerTarget(config) | Build a target directly. | | wrapFile(file, target?) | Build a file handle from a native File without a view. | | PictProviderUpload.formatBytes(bytes) | Human-readable size helper. |

Theming

All control CSS uses var(--theme-color-*, fallback) tokens (registered at CSS priority 500), so the dropzone, progress bar, and status badges follow the host theme. See pict-section-theme for the token set.

Demo

example_applications/upload_demo — four uploaders (read-text, multi-image thumbnails, mock-server-with-progress, and Accept/MaxSize rejection). Build with npm run build, then serve dist/.

Test

npm test     # mocha TDD