0

I'm making cordova ios application with meteor. And I'm using one custom made camera plugin. After recording a video I get only local path of that video. I have to make File object with that path. I tried new File('etc/path') but it doesn't work.

Edit: I tried to make blob and make New File([blob], 'name), but that doesn't work either.

Thanks,

Igor

Igor Djukic
  • 1
  • 1
  • 3
  • 1
    google [js create file](https://www.google.com/search?q=js+create+file&rlz=1C5CHFA_enUS688US688&oq=js+create+file&aqs=chrome..69i57j69i60l3j35i39j0.2221j0j7&sourceid=chrome&ie=UTF-8) – SaganRitual Mar 21 '18 at 23:42
  • I searched for that, but there is only how to create blob, I need File object with file name – Igor Djukic Mar 22 '18 at 08:27
  • https://developer.mozilla.org/en-US/docs/Web/API/File/File or possibly https://stackoverflow.com/a/26181292/1610473 – SaganRitual Mar 22 '18 at 08:31
  • I tried that also, but when I'm using `new File([""], "filename.txt", {type: "text/plain", lastModified: date})`, my file object looks like this `{name: Array [""], localUrl: "filename.txt", type: {type: "text/plain", lastModified: 112313}, size: 0, lastmodified: 0 }` – Igor Djukic Mar 22 '18 at 08:38
  • 1
    Ok, for future reference, you need to be much more detailed in your question. The first thing is that you have to say much more than "it doesn't work". You have to show what kind of result you want. And you need to give a sample of your code that will demonstrate the problem. don't post it to these comments. Edit your question and put the details there – SaganRitual Mar 22 '18 at 08:44
  • 1
    Are you setting up the file plugin accordingly to the doc : https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-file/index.html ? – Bertrand Mar 22 '18 at 09:07

1 Answers1

0

Thanks @Bertrand, you gave me an Idea how to fix the problem. I wrote this:

window.requestFileSystem(window.TEMPORARY, 5 * 1024 * 1024, function (fs){
          fs.root.getFile('output.mov', { create: true, exclusive: false }, function (fileEntry) {
              fileEntry.file(function (file){
                console.log(file)
              });
          }, (err) => {
            console.log(err)
          });
        }, (err) => {
          console.log(err)
        });
bfontaine
  • 18,169
  • 13
  • 73
  • 107
Igor Djukic
  • 1
  • 1
  • 3