1.1.4 • Published 7 years ago
f-send v1.1.4
Send a file to server
Install:
npm i f-send --saveUsage: 1) import into service o component
import { fileSend } from "fileSend";2) inject in the constructor
construct( private _fs:fileSend ){}3) usage:
_fs.send( File, "http://localhost:4002/upload" , "PUT" ,"imagen", true )
.then( r =>{
console.log(r) // server response
});'State' property returns the state an XMLHttpRequest
| Value | Description |
|---|---|
| 0 | Client has been created. open() not called yet. |
| 1 | XmlHttpRequest.open() has been called. |
| 2 | XmlHttpRequest.send() has been called, and headers and status are available. |
| 3 | Downloading; responseText holds partial data. |
| 4 | The operation is complete. |
let percentage:number;
percentage = _fs.State * 25;
// 1 => 25%
// 2 => 50%
// 3 => 75%
// 4 => 100%