Comments (3)
Note that when I modify your code to set the "authorization" header to the format given here, which skips signing and instead embeds the access/secret key directly, the upload succeeds.
from aws_s3_client.
+1 @mymikemiller did u solve it?
from aws_s3_client.
Nope. I switched to using Internet Archive's ia command line tool (docs here). My Dart code below uses Process.run to launch it. For authorization, credentialsFilePath
references the file generated with the following command:
./ia --config-file '.ia-{SCREEN_NAME}' configure
SCREEN_NAME can be found and set at https://archive.org/account/index.php?settings=1 when logged in, but should be lowercased and have spaces replaced with underscores to match what is seen after the '@' in the url for the user's library page at https://archive.org/details/@my_screen_name.
final args = [
'--config-file',
'$credentialsFilePath',
'upload',
'$identifier',
'${file.path}',
'--remote-name=$identifier.mp4',
'--size-hint=${file.lengthSync()}',
'--no-derive',
'--metadata=mediatype:movies',
'--metadata=collection:opensource_movies',
];
await Process.run('./ia', args);
I actually use Process.start to get upload progress by regex matching on stderr as it uploads. Here's that code in case it's useful to someone:
await Process.start('./ia', args)
.then((p) async {
p.stderr.transform(Utf8Decoder()).listen((String data) {
if (data.contains('This item has been taken offline')) {
// Probably shouldn't throw here, but for now it's ok as this only
// happens when the user deletes a video off ia, then tries to
// reupload with the same name. TODO: add retry logic that
// automatically changes the name
throw ('Upload failed. A video with the same name was probably previously deleted from this internet archive account. Consider changing the name and retrying.');
}
final progressRegex = RegExp(r'(\d+)%');
final progressMatch = progressRegex.firstMatch(data);
if (progressMatch != null) {
final progress = double.parse(progressMatch.group(1));
callback?.call(progress);
}
});
final exitCode = await p.exitCode;
if (exitCode != 0) {
throw 'upload error (exit code $exitCode)';
}
});
If anyone out there has comments on how I can improve my code, I'd love feedback. I'm still new to Dart.
from aws_s3_client.
Related Issues (8)
- _endpointUrl is initialized in bucket function
- migrate to nnbd
- crypto 3.0.1 dependency update HOT 1
- can we add idrive e2 to package providers ?
- How to implement a progress bar during uploading a file? HOT 1
- during bucket.listContents: Failed assertion: boolean expression must not be null HOT 2
- Delete file
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws_s3_client.