Meteor-files: ES6 Cannot find module 'meteor:package/ostrio/files'.

Created on 26 Sep 2016  Â·  18Comments  Â·  Source: veliovgroup/Meteor-Files

I'm having an issue:

How to implement on ES6 project? I've already put :

import { FilesCollection } from 'meteor/ostrio:files';

But at the console always showing Cannot find module 'meteor:package/ostrio/files'.

How I can call that class? Should I put typings definitions? Please help.

Thanks,

help wanted question

All 18 comments

Have you installed package itself?

@dr-dimitru Yes, I've already installed it using meteor add ostrio:files

Here are the installed packages:

$ meteor list
accounts-base              1.2.11  A user account system
blaze-html-templates       1.0.4* Compile HTML templates into reactive UI wit...
check                      1.2.3  Check whether a value matches a pattern
ecmascript                 0.5.8  Compiler plugin that supports ES2015+ in al...
es5-shim                   4.6.14  Shims and polyfills to improve ECMAScript ...
jquery                     1.11.9  Manipulate the DOM using CSS selectors
meteor-base                1.0.4  Packages that every Meteor app needs
meteortypescript:compiler  3.2.2  TypeScript compiler for Meteor
mobile-experience          1.0.4  Packages for a great mobile user experience
mongo                      1.1.12  Adaptor for using MongoDB and Minimongo ov...
ostrio:files               1.7.3  Upload files via DDP, HTTP and WebRTC/DC. T...
reactive-var               1.0.10  Reactive variable
reywood:publish-composite  1.4.2  Publish a set of related documents from mul...
shell-server               0.2.1  Server-side component of the `meteor shell`...
standard-minifier-css      1.2.0  Standard css minifier used with Meteor apps...
standard-minifier-js       1.2.0  Standard javascript minifiers used with Met...
tracker                    1.1.0  Dependency tracker to allow reactive callbacks

Hmm... weird..

  1. Put all default packages (_without_ :) on top of .meteor/packages file
  2. Add console.log(FilesCollection) at any file in /lib folder (to see if it's available in global scope)
  3. As option use it without ES6 import, as FilesCollection already in global scope

Here is my .meteor/packages file:

[email protected]             
[email protected]       
[email protected]                   
[email protected]    
[email protected]            
[email protected]                  
[email protected]                 

[email protected]   
[email protected]    
[email protected]                
[email protected]              

[email protected]
reywood:publish-composite
meteortypescript:compiler
shell-server
accounts-base
ostrio:files

How can FilesCollection will be a global variable? When I try to call the variable on browser console, the output is:
Uncaught ReferenceError: FilesCollection is not defined

Thanks,

How can FilesCollection will be a global variable? When I try to call the variable on browser console, the output is:
Uncaught ReferenceError: FilesCollection is not defined

Must be in global scope, if it isn't - something went wrong. What Meteor.Files

Hey @triasrahman have you solved it with Meteor.Files?

Hi @dr-dimitru, I still didn't understand. What do you mean solving with Meteor.Files ?

@triasrahman You can use Meteor.Files instead of FilesCollection

I've tested to use it but an error showed:
Property 'Files' does not exist on type 'typeof Meteor'

But when I try to call Meteor.Files on console, there is a function.

Anyway, I'm using TypeScript for it. Is that the problem?

But when I try to call Meteor.Files on console, there is a function.

Server ot Client? So you can use it, right?

Anyway, I'm using TypeScript for it. Is that the problem?

No, idea. Never used TS with Meteor

I've just solved it by creating typings definition, it's because I'm using TypeScript.

After that, I've got an error when trying to upload.

Images.insert is not a function

I follow your tutorial for uploading an image:

    // As plain base64:
    Images.insert({
      file: photo,
      isBase64: true, // <— Mandatory
      fileName: 'pic.jpg', // <— Mandatory
      type: 'image/jpg' // <— Mandatory
    });

The Images object is correct, it's a FilesCollection class. What's wrong?

Thanks!

Here is almost full TS definition for this package: https://github.com/VeliovGroup/Meteor-Files/issues/226

@dr-dimitru thanks!

Anyway, I just realized that I did Images.insert() on server side. It must be on client side right?

I'm using meteor-client-side (https://github.com/idanwe/meteor-client-side) for my Ionic project. Is it possible to upload/store image that triggered using Meteor methods? So the image data will be passed from client to server using method, and then the server store the image.

Thanks,

Anyway, I just realized that I did Images.insert() on server side. It must be on client side right?

Right, on server there is bunch of methods like load, addFile, write

Is it possible to upload/store image that triggered using Meteor methods? So the image data will be passed from client to server using method, and then the server store the image.

Yes, you just pass it as Base64 or TypedArray to method, then write to FS, but in this case no need to use this lib

@dr-dimitru Where I can find the docs for addFile and write ?

@dr-dimitru thanks :)

Do not heistate to ask more questions, thank you for a choice.

Please, support this project by:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

msgfxeg picture msgfxeg  Â·  3Comments

dr-dimitru picture dr-dimitru  Â·  3Comments

mking200 picture mking200  Â·  4Comments

owenhoskins picture owenhoskins  Â·  3Comments

schlaegerz picture schlaegerz  Â·  3Comments