node-formidable / formidable

The most used, flexible, fast and streaming parser for multipart form data. Supports uploading to serverless environments, AWS S3, Azure, GCP or the filesystem. Used in production.
MIT License
7.01k stars 680 forks source link

Upgrading from v1 to v2 changes File properties, even though documentation says v2 is API backwards compatible with v1 #773

Closed gboer closed 2 years ago

gboer commented 2 years ago

Support plan

Context

What are you trying to achieve or the steps to reproduce?

In V1, the API for the 'File' object looks like this (roughly):

interface File {
  size: number;
  path: string;
  name: string;
  type: string;
  hash: null | string;
  lastModifiedDate: Date;
  domain: null | string;
}

What was the result you got?

In V2, the API for the 'File' object looks like this (roughly):

interface File {
  size: number;
  filepath: string; // previously 'path'
  originalFilename: string; // previously 'name'
  newFilename: string; // new
  mimetype: string; // previously 'type'
  hash: null | string;
  lastModifiedDate: Date;
  domain: null | string;
}

What result did you expect?

I read the version notes here and it says that the V2 API is backwards compatible with V1, but that is apparently not the case. It would be helpful if the documentation could be updated to reflect the changes, so that people can more easily migrate their code.

GrosSacASac commented 2 years ago

Thanks I updated the notes, please have a look at the changelog to upgrade from v1 to v2

gboer commented 2 years ago

thanks :)

tunnckoCore commented 2 years ago

Well, because they should have remained. Lets just add them? If only that's the problem for compat.