Takes files from React side, creates
    SolveBio Object containing signed S3 URL.
977888
def generate_s3_url(files):
    """"""
    if files:
        vault = g.client.Vault.get_personal_vault()
        files = json.loads(files)
        objects = []
        for i in xrange(len(files)):
            obj = g.client.Object.create(
                vault_id=vault.id,
                object_type='file',
                filename=files[i].get('filename'),
                mimetype=files[i].get('mimetype'),
                size=files[i].get('size')
            )
            objects.append({
                'id': obj.id,
                'filename': obj.filename,
                'upload_url': obj.upload_url
            })
        return json.dumps(objects)
484508
function (options) {
        var s3 = {};
        s3.client = connectToS3(options);
        s3.bucket = options.bucket || '';
        return s3;
    }
1295516
private void getObject(WebContext ctx, Bucket bucket, String id, boolean sendFile) throws IOException {
        StoredObject object = bucket.getObject(id);
        if (!object.exists()) {
            signalObjectError(ctx, HttpResponseStatus.NOT_FOUND, "Object does not exist");
            return;
        }
        Response response = ctx.respondWith();
        Properties properties = object.getProperties();
        for (Map.Entry<Object, Object> entry : properties.entrySet()) {
            response.addHeader(entry.getKey().toString(), entry.getValue().toString());
        }
        for (Map.Entry<String, String> entry : getOverridenHeaders(ctx).entrySet()) {
            response.setHeader(entry.getKey(), entry.getValue());
        }

        String etag = properties.getProperty(HTTP_HEADER_NAME_ETAG);
        if (Strings.isEmpty(etag)) {
            HashCode hash = Files.hash(object.getFile(), Hashing.md5());
            etag = BaseEncoding.base16().encode(hash.asBytes());
            Map<String, String> data = new HashMap<>();
            properties.forEach((key, value) -> data.put(key.toString(), String.valueOf(value)));
            data.put(HTTP_HEADER_NAME_ETAG, etag);
            object.storeProperties(data);
        }

        response.addHeader(HTTP_HEADER_NAME_ETAG, etag(etag));
        response.addHeader(HttpHeaderNames.ACCESS_CONTROL_EXPOSE_HEADERS, HTTP_HEADER_NAME_ETAG);
        if (sendFile) {
            response.file(object.getFile());
        } else {
            String contentType = MimeHelper.guessMimeType(object.getFile().getName());
            response.addHeader(HttpHeaderNames.CONTENT_TYPE, contentType);
            response.addHeader(HttpHeaderNames.LAST_MODIFIED,
                               RFC822_INSTANT.format(Instant.ofEpochMilli(object.getFile().lastModified())));
            response.addHeader(HttpHeaderNames.CONTENT_LENGTH, object.getFile().length());
            response.status(HttpResponseStatus.OK);
        }
        signalObjectSuccess(ctx);
    }
589075
function resolve(files, opts) {
  var fn = opts.filter || function(fp) {
    return true;
  };

  if (opts.realpath === true) {
    return files.filter(fn);
  }

  var len = files.length;
  var idx = -1;
  var res = [];

  while (++idx < len) {
    var fp = path.resolve(opts.cwd, files[idx]);
    if (!fn(fp) || ~res.indexOf(fp)) continue;
    res.push(fp);
  }
  return res;
}
1289643
public static String getDownLoadSign(String bucketName, String cosPath, Credentials cred, long expired)
			throws AbstractCosException {
		return appSignatureBase(cred, bucketName, cosPath, expired, false);
	}
1042124
def fetch_file(uri, file=None, username=None, password=None):
    
    boto.log.info('Fetching %s' % uri)
    if file == None:
        file = tempfile.NamedTemporaryFile()
    try:
        if uri.startswith('s3://'):
            bucket_name, key_name = uri[len('s3://'):].split('/', 1)
            c = boto.connect_s3(aws_access_key_id=username, aws_secret_access_key=password)
            bucket = c.get_bucket(bucket_name)
            key = bucket.get_key(key_name)
            key.get_contents_to_file(file)
        else:
            if username and password:
                passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
                passman.add_password(None, uri, username, password)
                authhandler = urllib2.HTTPBasicAuthHandler(passman)
                opener = urllib2.build_opener(authhandler)
                urllib2.install_opener(opener)
            s = urllib2.urlopen(uri)
            file.write(s.read())
        file.seek(0)
    except:
        raise
        boto.log.exception('Problem Retrieving file: %s' % uri)
        file = None
    return file
1350147
function (req, res) {
                var s3 = new AWS.S3(),
                    bucket = req.params.name,
                    key = getFullKeyParam(req.params, req.route),
                    params = {
                        Bucket: bucket,
                        Key: key
                    },
                    handleError = function (err) {
                        res.status(500).send(err);
                    };

                s3.getObject(params).createReadStream().on('error', handleError).pipe(res);

            }
240502
function uriToBlob(uri, done) {
  const xhr = new XMLHttpRequest();
  xhr.responseType = "blob";
  xhr.onload = () => {
    const blob = xhr.response;
    done(null, blob);
  };
  xhr.onerror = (err) => {
    done(err);
  };
  xhr.open("GET", uri);
  xhr.send();
}
685897
function (cb) {
      get(SOLVENCY_SERVER + domain, function (roots) {
        roots = roots || [];
        roots.forEach(function (root) {
          files.push({ path: 'root', type: 'root', content: root });
        });
        cb();
      });
    }
997933
def upload(cookie, source_path, path, upload_mode):
    '''
    '''
    ondup = const.UPLOAD_ONDUP[upload_mode]
    dir_name, file_name = os.path.split(path)
    url = ''.join([
        const.PCS_URL_C,
        'file?method=upload&app_id=250528',
        '&ondup=', ondup,
        '&dir=', encoder.encode_uri_component(dir_name),
        '&filename=', encoder.encode_uri_component(file_name),
        '&', cookie.sub_output('BDUSS'),
    ])
    with open(source_path, 'rb') as fh:
        data = fh.read()
    fields = []
    files = [('file', file_name, data)]
    headers = {'Accept': const.ACCEPT_HTML, 'Origin': const.PAN_URL}
    req = net.post_multipart(url, headers, fields, files)
    if req:
        return json.loads(req.data.decode())
    else:
        return None
570728
function (req, res) {
                var s3 = new AWS.S3(),
                    bucket = req.params.name,
                    params = {
                        Bucket: bucket
                    },
                    handleCreateBucket = function (err, data) {
                        if (err) {
                            res.status(500).send(err);
                        } else {
                            // Add s3g link to reference the resource
                            data.links = [{
                                rel: 'self',
                                href: getOriginalink(req, bucket)
                            }];

                            res.json(data);
                        }
                    };

                s3.createBucket(params, handleCreateBucket);
            }
87628
function (location, opts, callback) {
        resolve(location, function (err, fileUri) {
            if (err) {
                return callback(err)
            }

            bundle(fileUri, opts, callback)
        })
    }
205619
function FileInputStream(src){
    // wrap into Promise
    return new Promise(function(resolve, reject){

         // 
        const istream = _fs.createReadStream(src);
        istream.on('error', reject);
        istream.on('open', function(){
            resolve(istream);
        });
    });
}
1062777
def s3(ctx, bucket_name, data_file, region):
    """"""
    if not ctx.data_file:
        ctx.data_file = data_file

    if not ctx.bucket_name:
        ctx.bucket_name = bucket_name

    if not ctx.region:
        ctx.region = region

    ctx.type = 's3'
1280868
async function buildPathsObject(files) {
  return Promise.all(
    files.map(async filepath => {
      const name = path.basename(filepath, '.svg');
      const svg = fs.readFileSync(filepath, 'utf-8');
      const pathStrings = await svgo.optimize(svg, { path: filepath })
        .then(({ data }) => data.match(/ d="[^"]+"/g) || [])
        .then(paths => paths.map(s => s.slice(3)));
      return `"${name}": [${pathStrings.join(',\n')}]`;
    }),
  );
}
190287
function (req, res) {
                var s3 = new AWS.S3(),
                    bucket = req.params.name,
                    location = getLocation(req),
                    params = {
                        Bucket: bucket,
                        Delimiter: req.query.delimiter,
                        Marker: req.query.marker,
                        MaxKeys: req.query.maxKeys || DEFAULT_MAX_KEYS,
                        Prefix: req.query.prefix
                    },
                    handleListObjects = function (err, data) {
                        if (err) {
                            res.status(500).send(err);
                        } else {
                              
                            // Get link for this set
                            data.links = [{
                                rel: 'self',
                                href: getOriginalink(req)
                            }];
                            
                            // Map through bucket contents to filter out self reference and add links
                            data.Contents = data.Contents.map(function (content) {
                                // Add s3g link to reference the resource
                                content.links = [{
                                    ref: 'self',
                                    href: getS3ObjectLink(req, bucket, content)
                                }];
                                
                                // Filter out any references to the parent file
                                if (location.origin + location.search !== content.links[0].href) {
                                    return content;
                                }
                                
                            }).filter(Boolean);
                            
                            
                            // If this set of objects has a next marker that means there are > 1000 so provide the link to the next set of data
                            if (data.IsTruncated) {
                                // Get link for next set using next marker if available or the last key in the content set
                                data.links.push({
                                    rel: 'next',
                                    href: getNextMarkerLink(req, data.NextMarker || data.Contents[data.Contents.length - 1].Key)
                                });
                            }
                            res.json(data);
                        }
                    };
                
                s3.listObjects(params, handleListObjects);
            }
529920
function createFilenameForScript(url) {
    // TODO make this much more robust
    console.log("url:" + url);
    var parsed = urlParser.parse(url);
    if (inlineRegexp.test(url)) {
        return parsed.hash.substring(1) + ".js";
    } else {
        return parsed.pathname.substring(parsed.pathname.lastIndexOf("/") + 1);
    }
}