New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

lazy-upload

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lazy-upload

Simplify the file upload flow

  • 0.2.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by200%
Maintainers
1
Weekly downloads
 
Created
Source

Welcome to lazy-upload 👋

lazy-upload is a library which aims to simplify the file upload flow

Version Commit Activity Build Status Bundle Size

Installing

Using npm:

npm i --save lazy-upload

Using yarn:

yarn add --dev lazy-upload

Usage

Here are examples of how you can use lazy-upload.

useLazyUpload

File upload hook

Examples
Basic
const UPLOAD_FILES_URL = '';

export const UploadField = () => {
  const {
    acceptedFiles,
    attributes,
    rejectedFiles,
    reset,
    upload,
    uploadedFiles,
  } = useLazyUpload({});
  console.log({ rejectedFiles, uploadedFiles });
  return (
    <form
      onSubmit={e => {
        upload({
          config: {
            url: UPLOAD_FILES_URL,
            method: 'POST',
          },
          fileList: acceptedFiles,
        });
        e.preventDefault();
      }}
    >
      <label htmlFor="file-upload">Choose files:</label>
      <input {...attributes} id="file-upload" name="file-upload" />
      <button onClick={reset}>Reset</button>
      <button type="submit">Submit</button>
    </form>
  );
};

Running the tests

Tests are written with jest

Unit tests

Using jest:

yarn run test

Deployment

Deployment is done with Travis.

Built With

  • TSDX - TSDX

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

Show your support

Give a ⭐️ if this project helped you!

License

This project is licensed under the MIT License - see the LICENSE file for details

Keywords

FAQs

Package last updated on 26 Aug 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc