{"id":10889,"library":"filepicker-js","title":"Filepicker.js Client Library","description":"The `filepicker-js` package is the JavaScript client library for the original Filepicker.io service, which was acquired and rebranded as Filestack in 2015. The library's latest version, 2.4.18, was published over 10 years ago, indicating it is no longer actively maintained under this name. Modern development and new features are now exclusively available through the `filestack-js` SDK. This library primarily provides methods for file picking, storing, reading, writing, and basic image transformations, facilitating direct integration of file upload capabilities from various sources into web applications. It supports traditional browser script tag inclusion, exposing `window.filepicker`, and CommonJS `require()` for compatibility with older bundlers like Browserify. Its primary differentiator was simplifying file ingestion from diverse sources into web applications.","status":"deprecated","version":"2.4.18","language":"javascript","source_language":"en","source_url":"https://github.com/filepicker/filepicker-js","tags":["javascript","filepicker","file","upload","processing","store","widget"],"install":[{"cmd":"npm install filepicker-js","lang":"bash","label":"npm"},{"cmd":"yarn add filepicker-js","lang":"bash","label":"yarn"},{"cmd":"pnpm add filepicker-js","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The library primarily exposes 'filepicker' as a global object when loaded via a script tag. It does not provide ES Module exports. This global object contains all public methods.","wrong":"import filepicker from 'filepicker-js';","symbol":"filepicker","correct":"<!-- In HTML -->\n<script type=\"text/javascript\" src=\"//api.filepicker.io/v2/filepicker.js\"></script>\n<script type=\"text/javascript\">\n  // 'filepicker' is now a global object\n  filepicker.setKey('YOUR_API_KEY');\n</script>"},{"note":"For environments using CommonJS (e.g., Node.js or older bundlers like Browserify), the library can be imported using 'require()'. It does not support ES Module `import` syntax.","wrong":"import * as filepicker from 'filepicker-js';","symbol":"filepicker","correct":"const filepicker = require('filepicker-js');"},{"note":"The `pick` method, along with others like `setKey`, `pickMultiple`, `store`, etc., are accessed directly from the `filepicker` object, whether it's the global `window.filepicker` or the CommonJS import.","wrong":"filepicker.pick(...); // Without explicit window. or require()","symbol":"pick","correct":"window.filepicker.pick(...); // After script tag load\n// OR\nconst filepicker = require('filepicker-js'); filepicker.pick(...); // With CommonJS"}],"quickstart":{"code":"<html>\n<head>\n  <title>Filepicker.js Quickstart</title>\n</head>\n<body>\n  <h1>Upload a File with Filepicker.js</h1>\n  <button id=\"upload-button\">Pick File</button>\n\n  <script type=\"text/javascript\" src=\"//api.filepicker.io/v2/filepicker.js\"></script>\n  <script type=\"text/javascript\">\n    // Replace with your actual API key from Filepicker.io (or Filestack)\n    const API_KEY = process.env.FILEPICKER_API_KEY ?? 'YOUR_FILEPICKER_API_KEY';\n\n    (function(){\n      if(!window.filepicker) {\n        console.error('Filepicker.js failed to load.');\n        return;\n      }\n\n      filepicker.setKey(API_KEY);\n\n      document.getElementById('upload-button').addEventListener('click', function() {\n        filepicker.pick({\n          mimetype: 'image/*',\n          container: 'window',\n          services: ['COMPUTER', 'DROPBOX', 'GOOGLE_DRIVE', 'FACEBOOK']\n        }, function(Blob){\n          console.log('Upload successful! File details:', JSON.stringify(Blob));\n          alert('File uploaded: ' + Blob.url);\n        }, function(FPError){\n          console.error('Upload failed:', FPError.toString());\n          alert('File upload failed: ' + FPError.toString());\n        });\n      });\n\n      console.log('Filepicker.js initialized. Click the button to pick a file.');\n    })();\n  </script>\n</body>\n</html>","lang":"javascript","description":"This quickstart demonstrates how to integrate `filepicker-js` into an HTML page, set the API key, and initiate a file selection and upload process using the `pick` method, displaying the uploaded file's URL."},"warnings":[{"fix":"Migrate your integration to the `filestack-js` library (available via `npm install filestack-js`) and update your API key and usage patterns according to Filestack's current documentation.","message":"The `filepicker-js` package is deprecated. The underlying service, Filepicker.io, was rebranded to Filestack in 2015. Active development, maintenance, and new features are now exclusively available through the `filestack-js` SDK. Users should plan to migrate to `filestack-js` for continued support and access to modern capabilities.","severity":"breaking","affected_versions":">=2.x"},{"fix":"When using in modern environments, ensure proper bundling (e.g., Webpack or Rollup with CJS plugins) or consider using `filestack-js` which offers better ES Module support. If using `<script>` tags, ensure the `filepicker.js` script loads before attempting to access `window.filepicker`.","message":"The library primarily relies on exposing `filepicker` as a global variable when loaded via a `<script>` tag or expects a CommonJS `require()` pattern. It does not natively support modern ES Module (`import/export`) syntax, which can lead to integration challenges in contemporary JavaScript projects.","severity":"gotcha","affected_versions":">=2.x"},{"fix":"Avoid using Bower. If you must use this deprecated library, rely on npm (`npm install filepicker-js`) for package management in conjunction with a CommonJS-aware bundler like Browserify, or directly include the script via a `<script>` tag.","message":"The README mentions Bower as an installation method for `filepicker-js`. Bower is a deprecated package manager and should not be used for new projects or ongoing maintenance.","severity":"deprecated","affected_versions":">=2.x"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Ensure the `<script src=\"//api.filepicker.io/v2/filepicker.js\"></script>` tag is correctly placed in your HTML, preferably in the `<head>` or before your application code, and that there are no network issues preventing its load. For non-blocking loading, use the provided asynchronous script snippet.","cause":"The `filepicker.js` script was not loaded successfully via a `<script>` tag, or the global `filepicker` object was accessed before the script completed execution.","error":"ReferenceError: filepicker is not defined"},{"fix":"Verify that `filepicker.js` has completely loaded and the `filepicker` global is fully populated before calling `setKey`. If loading asynchronously, place `setKey` within a callback or after an event that signifies library readiness.","cause":"The `filepicker` object exists but is not fully initialized, or its methods are not yet available. This often happens if `filepicker.js` is still loading asynchronously or if the API key is not being set correctly after initialization.","error":"TypeError: filepicker.setKey is not a function"},{"fix":"Run `npm install filepicker-js --save` to ensure the package is installed. If using a bundler, confirm its configuration correctly handles CommonJS modules and that the package is included in the build process.","cause":"When using `require('filepicker-js')` in a CommonJS environment, this error indicates that the `filepicker-js` package was not installed or your bundler (e.g., Browserify) failed to resolve it.","error":"Cannot find module 'filepicker-js'"}],"ecosystem":"npm"}