Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. const info = await FileSystem.getInfoAsync(recording.getURI());
  2. console.log(`FILE INFO: ${JSON.stringify(info)}`);
  3.  
  4. FILE INFO: {"size":548864,"modificationTime":1553094025.727294,"uri":"file:///var/mobile/Containers/Data/Application/8488FB96-5F96-4690-84CC-C52B4E2136C8/Library/Caches/ExponentExperienceData/%2540christophera%252Fencounters-app/AV/recording-5C8E7D16-BA89-4DD7-B249-D0865D191BDD.caf","isDirectory":false,"exists":true}
  5.  
  6. const response = await fetch(fileURI);
  7. const blob = await response.blob();
  8.  
  9. {"_data":{"blobId":"260ee7da-4e7d-401a-9243-09f1cd85149f","offset":0,"size":243976,"type":"","lastModified":1553093860777}}
  10.  
  11. let formData = new FormData();
  12. formData.append('soundBlob', blob, fileName);
  13. console.log(formData);
  14. const options = {
  15. method: 'POST',
  16. body: formData,
  17. headers: {
  18. 'enctype': 'multipart/form-data',
  19. },
  20. };
  21. await fetch(fileAPI_server, options)
  22. .then(response => console.log(response.status))
  23. .catch(error => console.log('Error:', error));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement