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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@stackone/file-picker

v0.7.1

Published

Navigate and select files from connected integrations

Readme

StackOne File Picker

Allow your users to select files from your integrations. The @stackone/file-picker introduces an easy-to-use SDK to embed the StackOne file picker into your application.

Install

# NPM
npm install --save @stackone/file-picker

# Yarn
yarn add @stackone/file-picker

Usage

Initialize the File Picker with your options, and then call the open method to open the file picker. Listen to the callbacks to know when a file has been picked or whether the flow has been cancelled. The callback will give you the information about the file picked - you may also retrieve this information by using webhooks or the API. For example purposes, we used React as the framework, but you can use any framework built on top of Javascript/Typescript.

import { FilePicker } from '@stackone/file-picker';

export const FilePickerButton = () => {
  const [filePicker, setFilePicker] = useState<FilePicker | null> (null);

  useEffect(() => {
    const initializePicker = async () => {
      const { sessionToken } = await retrieveAPISessionToken();

      setFilePicker(new FilePicker({ sessionToken }));
    };

    initializePicker();
  }, []);

  const handleClick = useCallback(() => {
    filePicker?.open();
  }, [filePicker]);

  return (
    <button onClick={handleClick} disabled={!filePicker}>
      Open File Picker
    </button>
  );
};

File Picker Options

Apart from the sessionToken, you may pass a few options to customize the File Picker.

// Example of Options object
const options = {
    sessionToken = 'your-session-token',
    containerId = 'file-picker-container',
    baseUrl = 'https://app.stackone.com',
    fields = ['name', 'path', 'driveId'],
    showBranding = false,
    folderSelectionEnabled = true,
    driveSelectionEnabled = true,
    onFilesPicked = (data) => {
        // data may contain files, folders, and/or drives based on what was selected
        if (data.files) {
            console.log('Selected files:', data.files);
        }
        if (data.folders) {
            console.log('Selected folders:', data.folders);
        }
        if (data.drives) {
            console.log('Selected drives:', data.drives);
        }
    },
    onOpen = () => {
            console.log('File picker opened');
        },
    onClose = () => {
        console.log('File picker closed');
    },
    onCancel = () => {
        console.log('File selection canceled');
    }
};

const filePicker = new FilePicker(options);

| Name | Type | Required | Description | | ----------------- | -------- | -------- | ------------------------------------------------------------------------------------------------------------------------- | | sessionToken | string | Yes | API session token created in the backend. The session token allows users to have access to their file picker integration. | | containerId | string | No | ID of the container element where the file picker will be mounted. | | baseUrl | string | No | Which API instance should it connect to. | | fields | string[] | No | Which fields from the raw picked file will be mapped on the files picked callback. | | showBranding | boolean | No | Show StackOne footer on the file picker, it is defaulted to true. | | folderSelectionEnabled | boolean | No | Enable the selection of folders on the unified and native pickers. | | driveSelectionEnabled | boolean | No | Enable the selection of drives on the unified and native pickers. | | onFilesPicked | function | No | Called when files are selected. | | onOpen() | function | No | Called when the file picker is opened. | | onClose() | function | No | Called every time the file picker is closed regardless of whether a file has been picked or not. | | onCancel() | function | No | Called when the file picker is closed without a file being selected. | | onError() | function | No | Called when the file picker has an error. |

Callback Data Structure

When you get the callback from the onFilesPicked function, you will receive an object that may contain one or more of the following properties based on what was selected:

  • files (optional): An array of selected files
  • folders (optional): An array of selected folders when folderSelectionEnabled is true
  • drives (optional): An array of selected drives/sites when driveSelectionEnabled is true

Note: The callback will only include the arrays that have items. For example, if only files are selected, only the files property will be present.

File and Folder Types

Files and folders share the same structure: | Name | Type | Required | Description | | ----------------- | -------- | -------- | ------------------------------------------------------------------------------------------------------------------------- | | id | string | Yes | The Unified Id for the file. | | name | string | No | The name of the file or folder. | | path | string | No | The URL or path of the file or folder. | | driveId | string | No | The Drive ID where the file or folder is located. |

Drive Type

Drives have a different structure: | Name | Type | Required | Description | | ----------------- | -------- | -------- | ------------------------------------------------------------------------------------------------------------------------- | | id | string | Yes | The Unified Id for the drive. | | name | string | No | The name of the drive or site. | | type | string | No | Will be 'site' for drives. | | createdAt | string | No | The creation date of the drive. |

Contribute & Release

This repose uses conventional commit. The repo use semantic-release and the package version is automatically determined based on the commit messages.

Release

Use the Manual release workflow to trigger a release. The package version and changelog will automatically be generated based on conventional commits.