Skip to content

Commit

Permalink
Merge pull request #136 from Rishikant181/dev
Browse files Browse the repository at this point in the history
v3.5.0-alpha.2
  • Loading branch information
Rishikant181 authored Mar 5, 2024
2 parents b1b6bd6 + 6f6ea61 commit 9120d5f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ Sending this request uploads the media file to Twitter.

Notes:

- Instead of a path to a locally stored file, a Readable stream can also be uploaded
- Instead of a path to a locally stored file, an ArrayBuffer containing the media can also be uploaded

#### 3. Finalization

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rettiwt-core",
"version": "3.5.0-alpha.1",
"version": "3.5.0-alpha.2",
"description": "The core library for the reverse-engineered Twitter API",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
4 changes: 3 additions & 1 deletion src/models/Request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ export class Request {
const data = new FormData();
data.append(
'media',
typeof args.upload.media == 'string' ? createReadStream(args.upload.media) : args.upload.media,
typeof args.upload.media == 'string'
? createReadStream(args.upload.media)
: Buffer.from(args.upload.media as ArrayBuffer),
);

this.params = new UploadQuery(args.upload);
Expand Down
3 changes: 1 addition & 2 deletions src/models/args/PostArgs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
MaxLength,
validateSync,
} from 'class-validator';
import { Readable } from 'stream';

// ENUMS
import { EResourceType } from '../../enums/Resources';
Expand Down Expand Up @@ -186,7 +185,7 @@ export class UploadArgs {
/** The media file to be uploaded. */
@IsOptional()
@IsNotEmpty({ groups: [EUploadSteps.APPEND] })
public media?: string | Readable;
public media?: string | ArrayBuffer;

/** The id allocated to the media file to be uploaded. */
@IsOptional()
Expand Down

0 comments on commit 9120d5f

Please sign in to comment.