fromBytes method

  1. @override
Future<ThreeFile> fromBytes(
  1. Uint8List bytes, [
  2. String? type,
  3. String? location
])
override

bytes - the loaded bytes of the file

Implementation

@override
Future<ThreeFile> fromBytes(Uint8List bytes, [String? type, String? location]) async{
  String cacheName = String.fromCharCodes(bytes).toString().substring(0,50);
  final cached = Cache.get(cacheName);
  if (cached != null) {
    manager.itemStart(cacheName);
    manager.itemEnd(cacheName);
    return ThreeFile(type??'bytes',cached,'cache');
  }
  Cache.add(cacheName,bytes);
  return ThreeFile(type??'bytes',bytes,location);
}