.link is not a function when retrieving multiple files
See original GitHub issueI am having issues with using useTracker to retrieve a query of files: when writing:
const files = useTracker(() =>
MedicalStorage.find({ meta: { tag } }).fetch()
);
and later using inside a component:
{files.map((file) => (
<div>
<a
href={file.link()}
download={file.name}
key={file._id}
target="_parent"
>
download {file.name}
</a>
<button type="button" onClick={remove(file._id)}>
delete
</button>
</div>
))}
I am getting the error: file.link is not a function.
When using just .findOne() everything works as intended.
I tried using forEach and tried to generate the links into a static array in the tracker and then returning it but the same error occurred there.
I am receiving the file object as viewed by the console.log(file):
{
ext: "pdf"
extension: "pdf"
extensionWithDot: ".pdf"
isAudio: false
isImage: false
isJSON: false
isPDF: true
isText: false
isVideo: false
meta: {tag: "past-diagnoses"}
mime: "application/pdf"
mime-type: "application/pdf"
name: "andrey.pdf"
path: "assets/app/uploads/medStorage/XXsrw47TxGvpSNgrf.pdf"
public: false
size: 11626
type: "application/pdf"
userId: "Lvp2fZG3suKGy3oHE"
versions: {original: {…}}
_collectionName: "medicalStorage"
_downloadRoute: "/files/medStorage"
_id: "XXsrw47TxGvpSNgrf"
_storagePath: "assets/app/uploads/medStorage"
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Getting url.split is not a function at getFilenameFromURLin ...
I am getting the error above when uploading some of the files in my system... Below is the component using Filepond and React...
Read more >How to implement multiple file uploads in React?
If not, then head over to React Docs to get started. Setting Up. First, create the React app with the following command. create-react-app...
Read more >Dealing with multiple files | Just Enough R
Often you will have multiple data files files - for example, ... Using the list.files() function we can list the contents of a...
Read more >How to process multiple files in Power BI (and ... - YouTube
Processing multiple files in Power BI is a very common request and this can be easily accomplished with a built-in connector.
Read more >Run your functions from a package file in Azure - Microsoft Learn
Have the Azure Functions runtime run your functions by mounting a deployment package file that contains your function app project files.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@leprekon91 read docs on
.map()— Function to call. It will be called with three arguments: the file, a 0-based index, and cursor itselfI recommend to use
.eachor.forEach@leprekon91 I’m glad you solved it 👍
Please support this project with: