@jeetiss/callbag-xhr

1.0.1ย โ€ขย Publicย โ€ขย Published

callbag-xhr

Callbag source which wrap xhr request with first class cancel and progress support.

install

npm i @jeetiss/callbag-xhr

example

import pipe from "callbag-pipe";
import subscribe from "callbag-subscribe";
import request from "@jeetiss/callbag-xhr";

const data = new FormData();

data.append("UPLOADCARE_PUB_KEY", "demopublickey");
data.append("UPLOADCARE_STORE", "auto");
data.append("file", file);

pipe(
  request({
    method: "POST",
    url: "https://upload.uploadcare.com/base/",
    data,
    upload: true
  }),
  subscribe({
    next: val => console.log("next:", val),
    complete: () => console.log("done!"),
    error: err => console.log("error:", err)
  })
)

Package Sidebar

Install

npm i @jeetiss/callbag-xhr

Weekly Downloads

4

Version

1.0.1

License

MIT

Unpacked Size

5.34 kB

Total Files

4

Last publish

Collaborators

  • jeetiss