-
-
Notifications
You must be signed in to change notification settings - Fork 299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Creating png file from buffer | content is invalid #205
Comments
Ill look into it! |
Hi, Any update? |
Not yet sorry! Work has been pretty hectic :( |
Let me know when you can, still waiting for the resolution. Have only few days left for going live |
So ive tested this code with text content and it seems to work. It only fails when i test with base64 data. Im going to keep testing and see what i can come up with. |
Here got it to work, just needed to encode my image properly: const Gitlab = require('../../node-gitlab').default;
const { RepositoryFiles } = new Gitlab({
token: 'token',
});
const content = await Fs.readFile('small.png');
await RepositoryFiles.create(id, 'fake2.png', 'master', {
content: content.toString('base64'),
encoding: 'base64',
commit_message: 'message',
}); |
Perhaps make it a unit test and provide the example in readme? 😇 🙌 |
Thanks a lot. Closing the issue. will try to add to the documentation |
Add file creation to documentation #39 |
Getting: StatusCodeError: 400 - {"error":"content is invalid"}
using
When buffer was printed in console -
<Buffer 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 05 01 00 00 03 0f 08 06 00 00 00 65 a0 13 26 00 00 20 00 49 44 41 54 78 5e ec dd 09 dc 95 73 fe ... >
Please suggest
buffer was created with....
At Client
At Server
Originally posted by @anirbanctts in #200 (comment)
The text was updated successfully, but these errors were encountered: